[repo] call entity.check() once before_update hooks has been called, to let them a chance to transform data stable cubicweb-version-3.8.5
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 21 Jun 2010 11:13:25 +0200
branchstable
changeset 5808 2de32c0c293b
parent 5807 904897d79f86
child 5809 5d05b08adeab
[repo] call entity.check() once before_update hooks has been called, to let them a chance to transform data
server/repository.py
--- a/server/repository.py	Mon Jun 21 10:42:26 2010 +0200
+++ b/server/repository.py	Mon Jun 21 11:13:25 2010 +0200
@@ -1105,8 +1105,6 @@
         orig_edited_attributes = getattr(entity, 'edited_attributes', None)
         entity.edited_attributes = edited_attributes
         try:
-            if session.is_hook_category_activated('integrity'):
-                entity.check()
             only_inline_rels, need_fti_update = True, False
             relations = []
             source = self.source_from_eid(entity.eid, session)
@@ -1137,6 +1135,8 @@
                                   eidfrom=entity.eid, rtype=attr, eidto=value)
                 if not only_inline_rels:
                     hm.call_hooks('before_update_entity', session, entity=entity)
+            if session.is_hook_category_activated('integrity'):
+                entity.check()
             source.update_entity(session, entity)
             self.system_source.update_info(session, entity, need_fti_update)
             if source.should_call_hooks: