[repo ms] commit/rollback session if it has been created in the method stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 27 Jul 2011 19:36:09 +0200
branchstable
changeset 7716 c893150b2394
parent 7715 b97ca4136482
child 7717 e564c255bf29
[repo ms] commit/rollback session if it has been created in the method
server/repository.py
--- a/server/repository.py	Wed Jul 27 19:06:25 2011 +0200
+++ b/server/repository.py	Wed Jul 27 19:36:09 2011 +0200
@@ -1095,11 +1095,11 @@
             source.after_entity_insertion(session, extid, entity, sourceparams)
             if source.should_call_hooks:
                 self.hm.call_hooks('after_add_entity', session, entity=entity)
-            if commit:
+            if commit or free_cnxset:
                 session.commit(free_cnxset)
             return eid
         except Exception:
-            if commit:
+            if commit or free_cnxset:
                 session.rollback(free_cnxset)
             raise