blob: b23caf25b23fdb4c7f89f419f3ee0fa40495bce6 [file] [log] [blame]
Sapan Bhatia9c2c8fa2013-10-16 13:26:05 -04001from planetstack.config import Config
2
3try:
4 observer_disabled = Config().observer_disabled
5except:
6 observer_disabled = False
7
8print_once = True
9
10if (not observer_disabled):
11 from .event_manager import EventSender
12
13 def notify_observer(model=None, delete=False):
14 try:
15 if (model and delete):
16 EventSender().fire({'delete_flag':delete,'model':model.__name__})
17 else:
18 EventSender().fire()
19 except Exception,e:
20 print "Exception in Observer. This should not disrupt the front end. %s"%str(e)
21
22else:
23 def notify_observer(model=None, delete=False):
24 if (print_once):
25 print "The observer is disabled"
26 print_once = False
27 return