server/repository.py
branchstable
changeset 7716 c893150b2394
parent 7708 45be3a9debe6
child 7723 badfd5524ab6
--- 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