summaryrefslogtreecommitdiff
path: root/docs/tutorials/wiki2/basiclayout.rst
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2012-03-17 14:07:21 -0400
committerChris McDonough <chrism@plope.com>2012-03-17 14:07:21 -0400
commita7a639fe5b875f4e94e4c788fb93711315df62ae (patch)
treeecc6c92d27dcbb8f37a34e15799575d56903c84d /docs/tutorials/wiki2/basiclayout.rst
parent1e585bc07024b69e5fb792abcab4244b90a5b49e (diff)
downloadpyramid-a7a639fe5b875f4e94e4c788fb93711315df62ae.tar.gz
pyramid-a7a639fe5b875f4e94e4c788fb93711315df62ae.tar.bz2
pyramid-a7a639fe5b875f4e94e4c788fb93711315df62ae.zip
explain zopetransaction extension
Diffstat (limited to 'docs/tutorials/wiki2/basiclayout.rst')
-rw-r--r--docs/tutorials/wiki2/basiclayout.rst9
1 files changed, 9 insertions, 0 deletions
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: