]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- add a comment, also I think we want to expire before we do the
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 9 Jun 2015 16:20:07 +0000 (12:20 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 9 Jun 2015 16:20:07 +0000 (12:20 -0400)
new begin, as begin_nested() does a flush

doc/build/orm/session_transaction.rst

index 08f11afccb01a3aed675a0b1acaf312930bb2bf5..bca3e944fe304aa3a0cefce9e19e2901a216f64a 100644 (file)
@@ -504,7 +504,12 @@ everything is rolled back.
               @event.listens_for(self.session, "after_transaction_end")
               def restart_savepoint(session, transaction):
                   if transaction.nested and not transaction._parent.nested:
-                      session.begin_nested()
+
+                      # ensure that state is expired the way
+                      # session.commit() at the top level normally does
+                      # (optional step)
                       session.expire_all()
 
+                      session.begin_nested()
+
           # ... the tearDown() method stays the same