[repo] fix more indentation pb in repo.glob_update_entity, causing duplicated inline relation hooks call
--- a/server/repository.py Thu Apr 15 17:35:17 2010 +0200
+++ b/server/repository.py Thu Apr 15 17:57:41 2010 +0200
@@ -1076,6 +1076,7 @@
entity.check()
only_inline_rels, need_fti_update = True, False
relations = []
+ source = self.source_from_eid(entity.eid, session)
for attr in list(edited_attributes):
if attr == 'eid':
continue
@@ -1091,19 +1092,18 @@
previous_value = previous_value[0][0] # got a result set
if previous_value == entity[attr]:
previous_value = None
- else:
+ elif source.should_call_hooks:
hm.call_hooks('before_delete_relation', session,
eidfrom=entity.eid, rtype=attr,
eidto=previous_value)
relations.append((attr, entity[attr], previous_value))
- source = self.source_from_eid(entity.eid, session)
- if source.should_call_hooks:
- # call hooks for inlined relations
- for attr, value, _ in relations:
- hm.call_hooks('before_add_relation', session,
- eidfrom=entity.eid, rtype=attr, eidto=value)
- if not only_inline_rels:
- hm.call_hooks('before_update_entity', session, entity=entity)
+ if source.should_call_hooks:
+ # call hooks for inlined relations
+ for attr, value, _ in relations:
+ hm.call_hooks('before_add_relation', session,
+ eidfrom=entity.eid, rtype=attr, eidto=value)
+ if not only_inline_rels:
+ hm.call_hooks('before_update_entity', session, entity=entity)
source.update_entity(session, entity)
self.system_source.update_info(session, entity, need_fti_update)
if source.should_call_hooks: