observer_disabled was not being imported into core/models/user.py
Scott Baker [Thu, 9 Oct 2014 23:16:02 +0000 (16:16 -0700)]
planetstack/core/models/user.py

index 5a73ad7..1b3be29 100644 (file)
@@ -13,6 +13,20 @@ from core.middleware import get_request
 import model_policy
 from django.core.exceptions import PermissionDenied
 
+# ------ from plcorebase.py ------
+try:
+    # This is a no-op if observer_disabled is set to 1 in the config file
+    from observer import *
+except:
+    print >> sys.stderr, "import of observer failed! printing traceback and disabling observer:"
+    import traceback
+    traceback.print_exc()
+
+    # guard against something failing
+    def notify_observer(*args, **kwargs):
+        pass
+# ------ ------
+
 # Create your models here.
 class UserManager(BaseUserManager):
     def create_user(self, email, firstname, lastname, password=None):