Browse files

explain zopetransaction extension

  • Loading branch information...
1 parent 1e585bc commit a7a639fe5b875f4e94e4c788fb93711315df62ae @mcdonc mcdonc committed Mar 17, 2012
Showing with 9 additions and 0 deletions.
  1. +9 −0 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:

0 comments on commit a7a639f

Please sign in to comment.