diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-07-05 11:20:43 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-07-05 14:11:29 +0200 |
commit | d8decb491a4dec2a49e701220b616c51463f78fb (patch) | |
tree | 46fcb7e096d9654b079bdb85b3ff82f0b5a17b70 /ishtar_common | |
parent | 066ef132f7456b0783a2b403b3f6b4106b50fdb9 (diff) | |
download | Ishtar-d8decb491a4dec2a49e701220b616c51463f78fb.tar.bz2 Ishtar-d8decb491a4dec2a49e701220b616c51463f78fb.zip |
🐛 check of external identifiers when updating cached labels (refs #5603)
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/utils.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py index c6c14422c..673821c14 100644 --- a/ishtar_common/utils.py +++ b/ishtar_common/utils.py @@ -544,6 +544,7 @@ def load_task(task_func, task_name, checks, sender, **kwargs): def cached_label_changed(sender, **kwargs): + load_task(_external_id_changed, "external_id_changed", None, sender, **kwargs) return load_task(_cached_label_changed, "cached_label_changed", None, sender, **kwargs) @@ -633,7 +634,8 @@ def external_id_changed(sender, **kwargs): @task() def _external_id_changed(sender, **kwargs): sender, instance = deserialize_args_for_tasks(sender, kwargs, EXTRA_KWARGS_TRIGGER) - if not instance: + if not instance or not hasattr(instance, "external_id") \ + or not hasattr(instance, "auto_external_id"): return updated = False instance.no_post_process() @@ -643,12 +645,12 @@ def _external_id_changed(sender, **kwargs): updated = True instance.auto_external_id = True instance.external_id = external_id - updated |= instance.regenerate_all_ids(save=False) + if hasattr(instance, "regenerate_all_ids"): + updated |= instance.regenerate_all_ids(save=False) or False if updated: instance.save() - def shortify(lbl, number=20): SHORTIFY_STR = ugettext(" (...)") if not lbl: |