Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

explain zopetransaction extension

  • Loading branch information...
commit a7a639fe5b875f4e94e4c788fb93711315df62ae 1 parent 1e585bc
@mcdonc mcdonc authored
Showing with 9 additions and 0 deletions.
  1. +9 −0 docs/tutorials/wiki2/basiclayout.rst
9 docs/tutorials/wiki2/basiclayout.rst
@@ -186,6 +186,15 @@ Next we set up a SQLAlchemy "DBSession" object:
:language: py
+``scoped_session`` and ``sessionmaker`` are standard SQLAlchemy helpers.
+``scoped_session`` allows us to access our database connection globally.
+``sessionmaker`` creates a database session object. We pass to
+``sessionmaker`` the ``extension=ZopeTransactionExtension()`` extension
+option in order to allow the system to automatically manage datbase
+transactions. With ``ZopeTransactionExtension`` activated, our application
+will automatically issue a transaction commit after every request unless an
+exception is raised, in which case the transaction will be aborted.
We also need to create a declarative ``Base`` object to use as a
base class for our model:
Please sign in to comment.
Something went wrong with that request. Please try again.