summaryrefslogtreecommitdiff
path: root/ishtar_common/utils.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2017-01-10 01:18:28 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2017-01-10 01:18:28 +0100
commita95e41815be353f717e5a9347166e0bbc486c687 (patch)
treea4aec468c53ba6d5baa688df0dba3fbb8a588fb4 /ishtar_common/utils.py
parent99f0621b864550817931a46850e5194f571c9d81 (diff)
parent7475ae571619c3726e63c5cefc0215930cb83278 (diff)
downloadIshtar-a95e41815be353f717e5a9347166e0bbc486c687.tar.bz2
Ishtar-a95e41815be353f717e5a9347166e0bbc486c687.zip
Merge branch 'v0.9' into wheezy
Diffstat (limited to 'ishtar_common/utils.py')
-rw-r--r--ishtar_common/utils.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py
index 44112bca3..9b3c85694 100644
--- a/ishtar_common/utils.py
+++ b/ishtar_common/utils.py
@@ -60,11 +60,18 @@ def cached_label_changed(sender, **kwargs):
and instance._cached_label_checked:
return
instance._cached_label_checked = True
- lbl = instance._generate_cached_label()
- if lbl != instance.cached_label:
+ cached_labels = ['cached_label']
+ if hasattr(sender, 'CACHED_LABELS'):
+ cached_labels = sender.CACHED_LABELS
+ changed = False
+ for cached_label in cached_labels:
+ lbl = getattr(instance, '_generate_' + cached_label)()
+ if lbl != getattr(instance, cached_label):
+ setattr(instance, cached_label, lbl)
+ changed = True
+ if changed:
if hasattr(instance, '_cascade_change') and instance._cascade_change:
instance.skip_history_when_saving = True
- instance.cached_label = lbl
instance.save()
if hasattr(instance, '_get_associated_cached_labels'):
for item in instance._get_associated_cached_labels():