Changeset 5731
- Timestamp:
- 11/19/08 18:10:13 (2 months ago)
- Files:
-
- docs/2.0/docs/code_ext.py (moved) (moved from docs/2.0/docs/tgext.py)
- docs/2.0/docs/conf.py (modified) (1 diff)
- docs/2.0/docs/main/Wiki20/wiki20.rst (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
docs/2.0/docs/conf.py
r4953 r5731 24 24 # Add any Sphinx extension module names here, as strings. They can be extensions 25 25 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 26 extensions = ['sphinx.ext.autodoc', 'tgext'] 26 extensions = ['sphinx.ext.autodoc', 'code_ext'] 27 27 28 28 29 # Add any paths that contain templates here, relative to this directory. docs/2.0/docs/main/Wiki20/wiki20.rst
r5655 r5731 317 317 If you're familiar with SQLAlchemy this should look pretty standard to you. The only part that's different is that we use:: 318 318 319 transaction.commit()319 transaction.commit() 320 320 321 321 where you're used to seeing ``Session.commit()`` we use ``transaction.commit`` this calls the transaction manager which helps us to support cross database transactions, as well as transactions in non relational databases, but ultimately in the case of SQLAlchemy it calls Session.commit() just like might if you were doing it directly. … … 530 530 Although the ``page.data = data`` statement tells SQLAlchemy that you intend to store the page data in the database, nothing happens until the ``DBSession.flush()`` method is called. This is commonly refered to as the "unit of work" pattern, and it's an important structure for database developers because it allows SQLAlchemy to combine many operations into a single database update (or a minimized number of updates if some changes depend upon earlier changes) and thus be much more efficient in the database resources used. 531 531 532 SQLALchemy also provides a ``DBSession.commit() method which flushes and commits any changes you've made in a trasaction. TurboGears 2 provides a flexible transaction management system that automates this process wrapping each web request in it's own transaction and automatically rolling back that transaction if you get a python exception, or return an HTTP error code as your response.532 SQLALchemy also provides a ``DBSession.commit()`` method which flushes and commits any changes you've made in a trasaction. TurboGears 2 provides a flexible transaction management system that automates this process wrapping each web request in it's own transaction and automatically rolling back that transaction if you get a python exception, or return an HTTP error code as your response. 533 533 534 534 You don't have to do anything to use this transaction management system, it should just work. So, you can now make changes and save the page we were editing, just like a real