From a7a639fe5b875f4e94e4c788fb93711315df62ae Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 17 Mar 2012 14:07:21 -0400 Subject: explain zopetransaction extension --- docs/tutorials/wiki2/basiclayout.rst | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'docs/tutorials/wiki2/basiclayout.rst') diff --git a/docs/tutorials/wiki2/basiclayout.rst b/docs/tutorials/wiki2/basiclayout.rst index 6715b2bd7..9661fcd6e 100644 --- a/docs/tutorials/wiki2/basiclayout.rst +++ b/docs/tutorials/wiki2/basiclayout.rst @@ -186,6 +186,15 @@ Next we set up a SQLAlchemy "DBSession" object: :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: -- cgit v1.2.3