app/soc/logic/models/role.py
changeset 991 becede26c37f
parent 978 e05b09b53486
child 1001 2faa7f80e8b2
--- a/app/soc/logic/models/role.py	Sun Jan 25 16:50:24 2009 +0000
+++ b/app/soc/logic/models/role.py	Sun Jan 25 21:03:12 2009 +0000
@@ -23,6 +23,7 @@
   ]
 
 
+from soc.cache import sidebar
 from soc.logic.models import base
 
 import soc.models.role
@@ -62,5 +63,16 @@
 
     return group
 
+  def _updateField(self, entity, name, value):
+    """Special logic for role. If state changes to active we flush the sidebar.
+    """
+
+    if (name == 'state') and (entity.state != value) and value == 'active':
+      # in case the state of the role changes to active we flush the sidebar
+      # cache. Other changes will be visible after the retention time expires.
+      sidebar.flush(entity.user.account)
+
+    return True
+
 
 logic = Logic()