--- a/app/soc/logic/models/base.py Sat Jan 31 12:36:07 2009 +0000
+++ b/app/soc/logic/models/base.py Sat Jan 31 12:59:52 2009 +0000
@@ -31,6 +31,7 @@
from django.utils.translation import ugettext
+from soc.cache import sidebar
from soc.logic import dicts
from soc.views import out_of_band
@@ -108,11 +109,11 @@
def _onCreate(self, entity):
"""Called when an entity has been created.
-
+
Classes that override this can use it to do any post-creation operations.
"""
-
- pass
+
+ sidebar.flush()
def _onUpdate(self, entity):
"""Called when an entity has been updated.
--- a/app/soc/logic/models/document.py Sat Jan 31 12:36:07 2009 +0000
+++ b/app/soc/logic/models/document.py Sat Jan 31 12:59:52 2009 +0000
@@ -69,12 +69,5 @@
return True
- def _onCreate(self, entity):
- """Flush the sidebar cache when a new active role entity has been created.
- """
-
- if entity.is_featured:
- sidebar.flush()
-
logic = Logic()
--- a/app/soc/logic/models/group.py Sat Jan 31 12:36:07 2009 +0000
+++ b/app/soc/logic/models/group.py Sat Jan 31 12:59:52 2009 +0000
@@ -92,9 +92,5 @@
return True
- def _onCreate(self, entity):
- """Flushes the sidebar for the current user.
- """
- sidebar.flush()
logic = Logic()
--- a/app/soc/logic/models/notification.py Sat Jan 31 12:36:07 2009 +0000
+++ b/app/soc/logic/models/notification.py Sat Jan 31 12:59:52 2009 +0000
@@ -58,8 +58,7 @@
# there is only one unread notification so send out an email
notifications.sendNewNotificationMessage(entity)
- # flush the sidebar cache
- sidebar.flush(entity.scope.account)
+ super(Logic, self)._onCreate(entity)
def _updateField(self, entity, name, value):
"""If unread changes we flush the sidebar cache.
--- a/app/soc/logic/models/request.py Sat Jan 31 12:36:07 2009 +0000
+++ b/app/soc/logic/models/request.py Sat Jan 31 12:59:52 2009 +0000
@@ -71,5 +71,7 @@
# TODO(Lennard) Create a new request message
pass
+ super(Logic, self)._onCreate(entity)
+
logic = Logic()
--- a/app/soc/logic/models/role.py Sat Jan 31 12:36:07 2009 +0000
+++ b/app/soc/logic/models/role.py Sat Jan 31 12:59:52 2009 +0000
@@ -81,5 +81,7 @@
if entity.status == 'active':
sidebar.flush(entity.user.account)
+ super(View, self)._onCreate(entity)
+
logic = Logic()
--- a/app/soc/logic/models/site.py Sat Jan 31 12:36:07 2009 +0000
+++ b/app/soc/logic/models/site.py Sat Jan 31 12:59:52 2009 +0000
@@ -80,11 +80,5 @@
"""
return self.getFromFields(link_id=self.DEF_SITE_LINK_ID)
- def _onCreate(self, entity):
- """Flush the sidebar cache when a new active role entity has been created.
- """
-
- sidebar.flush()
-
logic = Logic()
--- a/app/soc/logic/models/user.py Sat Jan 31 12:36:07 2009 +0000
+++ b/app/soc/logic/models/user.py Sat Jan 31 12:59:52 2009 +0000
@@ -152,7 +152,8 @@
"""
notifications.sendWelcomeMessage(entity)
- sidebar.flush(entity.account)
+
+ super(Logic, self)._onCreate(entity)
logic = Logic()