app/soc/logic/models/role.py
changeset 1085 0afbdd0905ef
parent 1001 2faa7f80e8b2
child 1106 e14b0995cf29
equal deleted inserted replaced
1084:9c4221f7b747 1085:0afbdd0905ef
    62     group = group_logic.getForFields(fields, unique=True)
    62     group = group_logic.getForFields(fields, unique=True)
    63 
    63 
    64     return group
    64     return group
    65 
    65 
    66   def _updateField(self, entity, name, value):
    66   def _updateField(self, entity, name, value):
    67     """Special logic for role. If state changes to active we flush the sidebar.
    67     """Special logic for role. If status changes to active we flush the sidebar.
    68     """
    68     """
    69 
    69 
    70     if (name == 'state') and (entity.state != value) and value == 'active':
    70     if (name == 'status') and (entity.status != value) and value == 'active':
    71       # in case the state of the role changes to active we flush the sidebar
    71       # in case the status of the role changes to active we flush the sidebar
    72       # cache. Other changes will be visible after the retention time expires.
    72       # cache. Other changes will be visible after the retention time expires.
    73       sidebar.flush(entity.user.account)
    73       sidebar.flush(entity.user.account)
    74 
    74 
    75     return True
    75     return True
    76   
    76   
    77   def _onCreate(self, entity):
    77   def _onCreate(self, entity):
    78     """Flush the sidebar cache when a new active role entity has been created.
    78     """Flush the sidebar cache when a new active role entity has been created.
    79     """
    79     """
    80 
    80 
    81     if entity.state == 'active':
    81     if entity.status == 'active':
    82       sidebar.flush(entity.user.account)
    82       sidebar.flush(entity.user.account)
    83 
    83 
    84 
    84 
    85 logic = Logic()
    85 logic = Logic()