Do not rely on notifiction module being imported
authorSverre Rabbelier <sverre@rabbelier.nl>
Fri, 15 May 2009 23:05:13 +0200
changeset 2319 3eee2308f1dd
parent 2318 594b55099fab
child 2320 5bf22cd44c19
Do not rely on notifiction module being imported This has worked so far mostly by accident, but it turned out to be brittle while writing tests. This makes sure that the notification module is always imported before use.
app/soc/logic/helper/notifications.py
--- a/app/soc/logic/helper/notifications.py	Fri May 15 20:54:36 2009 +0200
+++ b/app/soc/logic/helper/notifications.py	Fri May 15 23:05:13 2009 +0200
@@ -191,6 +191,7 @@
       'scope_path': to_user.link_id
   }
 
+  import soc.logic.models.notification
   key_name = model_logic.notification.logic.getKeyNameFromFields(fields)
 
   # create and put a new notification in the datastore
@@ -204,6 +205,8 @@
       notification_entity: Notification about which the message should be sent
   """
 
+  import soc.views.models.notification
+
   # create the url to show this notification
   notification_url = "http://%(host)s%(index)s" % {
       'host' : os.environ['HTTP_HOST'],