git://git.onelab.eu
/
plstackapi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cfa4d11
)
avoid throwing exception for model_policies that don't exist
author
Scott Baker
<smbaker@gmail.com>
Thu, 9 Oct 2014 19:03:22 +0000
(12:03 -0700)
committer
Scott Baker
<smbaker@gmail.com>
Thu, 9 Oct 2014 19:03:22 +0000
(12:03 -0700)
planetstack/model_policy.py
patch
|
blob
|
history
diff --git
a/planetstack/model_policy.py
b/planetstack/model_policy.py
index
32d8f8e
..
ba0cb99
100644
(file)
--- a/
planetstack/model_policy.py
+++ b/
planetstack/model_policy.py
@@
-11,7
+11,8
@@
def post_save_handler(sender, instance, **kwargs):
if (not kwargs['update_fields']):
try:
- policy_handler = getattr(model_policies, policy_name)
- policy_handler.handle(instance)
+ policy_handler = getattr(model_policies, policy_name, None)
+ if policy_handler is not None:
+ policy_handler.handle(instance)
except:
pass