Changeset 5731

Show
Ignore:
Timestamp:
11/19/08 18:10:13 (2 months ago)
Author:
mramm
Message:

Changed the tgext to a better name (perhaps we can get this into the main sphinx...

Also fixed a couple of issues in wiki20 tutorial

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • docs/2.0/docs/conf.py

    r4953 r5731  
    2424# Add any Sphinx extension module names here, as strings. They can be extensions 
    2525# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 
    26 extensions = ['sphinx.ext.autodoc', 'tgext'] 
     26extensions = ['sphinx.ext.autodoc', 'code_ext'] 
     27 
    2728 
    2829# Add any paths that contain templates here, relative to this directory. 
  • docs/2.0/docs/main/Wiki20/wiki20.rst

    r5655 r5731  
    317317If you're familiar with SQLAlchemy this should look pretty standard to you.  The only part that's different is that we use:: 
    318318 
    319 transaction.commit() 
     319    transaction.commit() 
    320320 
    321321where 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.  
     
    530530Although 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. 
    531531 
    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.  
     532SQLALchemy 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. 
    533533 
    534534You 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