Chris McDonough
2012-03-17 a7a639fe5b875f4e94e4c788fb93711315df62ae
explain zopetransaction extension
1 files modified
9 ■■■■■ changed files
docs/tutorials/wiki2/basiclayout.rst 9 ●●●●● patch | view | raw | blame | history
docs/tutorials/wiki2/basiclayout.rst
@@ -186,6 +186,15 @@
      :linenos:
      :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: