[server] commit after serializing schema
authorJulien Cristau <julien.cristau@logilab.fr>
Tue, 04 Nov 2014 14:10:02 +0100
changeset 10024 2a08247b57fb
parent 10023 c3ab46842b2d
child 10025 7b72ecc3f4d2
[server] commit after serializing schema Use separate transactions for schema serialization and postcreate scripts execution, so that the latter can rely on the schema being persistently stored. This matters e.g. if something in a postcreate violates a unique_together constraint, we need the constraint persisted in order to raise a meaningful error. See #4525069.
server/__init__.py
--- a/server/__init__.py	Thu Aug 28 18:54:21 2014 +0200
+++ b/server/__init__.py	Tue Nov 04 14:10:02 2014 +0100
@@ -329,6 +329,7 @@
         mhandler.cmd_exec_event_script('pre%s' % event, apphome=True)
         # enter instance'schema into the database
         serialize_schema(cnx, schema)
+        cnx.commit()
         # execute cubicweb's post<event> script
         mhandler.cmd_exec_event_script('post%s' % event)
         # execute cubes'post<event> script if any