summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-01-15 15:22:11 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2014-01-15 15:22:11 -0500
commit4765895d10ff4bc89f30c99fa709438fa9764b6c (patch)
tree1b47400c0d848a5bea1b27931f8dea5ae3fa9ea0
parent46728df2b48d2a31b44fecf84c912a3b4d7fee8a (diff)
downloadsqlalchemy-4765895d10ff4bc89f30c99fa709438fa9764b6c.tar.gz
even simpler
-rw-r--r--doc/build/orm/session.rst12
1 files changed, 4 insertions, 8 deletions
diff --git a/doc/build/orm/session.rst b/doc/build/orm/session.rst
index ea811aab4..867f78a86 100644
--- a/doc/build/orm/session.rst
+++ b/doc/build/orm/session.rst
@@ -1727,20 +1727,16 @@ everything is rolled back.
# bind an individual Session to the connection
self.session = Session(bind=self.connection)
- # two events make sure a SAVEPOINT is always started
- # for this session. After the initial "begin"...
- @event.listens_for(self.session, "after_begin")
- def start_savepoint(session, transaction, connection):
- if not transaction.nested:
- session.begin_nested()
+ # start the session in a SAVEPOINT...
+ self.session.begin_nested()
- # ... and after the end of each "transaction", assuming
- # the transaction ending was the "nested" transaction
+ # then each time that SAVEPOINT ends, reopen it
@event.listens_for(self.session, "after_transaction_end")
def restart_savepoint(session, transaction):
if transaction.nested and not transaction._parent.nested:
session.begin_nested()
+
# ... the tearDown() method stays the same
.. _unitofwork_contextual: