Chris McDonough
2011-01-20 607d756e962dce912134e075dbcc5f11a91987f0
- The ``pyramid_zodb``, ``pyramid_routesalchemy`` and ``pyramid_alchemy``
paster templates now use a default "commit veto" hook when configuring the
``repoze.tm2`` transaction manager in ``development.ini``. This prevents a
transaction from being committed when the response status code is within
the 400 or 500 ranges. See also
http://docs.repoze.org/tm2/#using-a-commit-veto.
9 files modified
47 ■■■■ changed files
CHANGES.txt 10 ●●●●● patch | view | raw | blame | history
TODO.txt 3 ●●●●● patch | view | raw | blame | history
docs/tutorials/wiki/basiclayout.rst 8 ●●●●● patch | view | raw | blame | history
pyramid/paster_templates/alchemy/development.ini_tmpl 6 ●●●● patch | view | raw | blame | history
pyramid/paster_templates/alchemy/setup.py_tmpl 2 ●●● patch | view | raw | blame | history
pyramid/paster_templates/routesalchemy/development.ini_tmpl 8 ●●●● patch | view | raw | blame | history
pyramid/paster_templates/routesalchemy/setup.py_tmpl 2 ●●● patch | view | raw | blame | history
pyramid/paster_templates/zodb/development.ini_tmpl 6 ●●●● patch | view | raw | blame | history
pyramid/paster_templates/zodb/setup.py_tmpl 2 ●●● patch | view | raw | blame | history
CHANGES.txt
@@ -35,6 +35,16 @@
  has been mutated, a cookie will be sent back in the response.  Previously
  its default value was ``False``.
Paster Templates
----------------
- The ``pyramid_zodb``, ``pyramid_routesalchemy`` and ``pyramid_alchemy``
  paster templates now use a default "commit veto" hook when configuring the
  ``repoze.tm2`` transaction manager in ``development.ini``.  This prevents a
  transaction from being committed when the response status code is within
  the 400 or 500 ranges.  See also
  http://docs.repoze.org/tm2/#using-a-commit-veto.
1.0a10 (2011-01-18)
===================
TODO.txt
@@ -6,9 +6,6 @@
- Write a "Whats New" (delta from BFG 1.3)
- Use a commit veto when configuring repoze.tm2 in paster templates for
  non-1X, 2X, or 3X responses.
- Figure out how to slim the herd of paster templates.  Related:
  https://github.com/Pylons/pyramid/issues#issue/40,
  https://github.com/Pylons/pyramid/issues#issue/42,
docs/tutorials/wiki/basiclayout.rst
@@ -187,9 +187,11 @@
pipeline.  This is a piece of middleware which closes the ZODB connection
opened by the ``PersistentApplicationFinder`` at the end of the request.
The ``egg:repoze.tm#tm`` middleware is the last piece of middleware in the
pipeline.  This commits a transaction near the end of the request unless
there's an exception raised.
The ``tm`` middleware is the last piece of middleware in the pipeline.  This
commits a transaction near the end of the request unless there's an exception
raised or the HTTP response code is an error code.  The ``tm`` refers to the
``[filter:tm]`` section beneath the pipeline declaration, which configures
the transaction manager.
The final line in the ``[pipeline:main]`` section is ``tutorial``, which
refers to the ``[app:tutorial]`` section above it.  The ``[app:tutorial]``
pyramid/paster_templates/alchemy/development.ini_tmpl
@@ -11,9 +11,13 @@
[pipeline:main]
pipeline =
    egg:WebError#evalerror
    egg:repoze.tm2#tm
    tm
    {{package}}
[filter:tm]
use = egg:repoze.tm2#tm
commit_veto = repoze.tm:default_commit_veto
[server:main]
use = egg:Paste#http
host = 0.0.0.0
pyramid/paster_templates/alchemy/setup.py_tmpl
@@ -9,7 +9,7 @@
requires = [
    'pyramid',
    'repoze.tm2',
    'repoze.tm2>=1.0b1', # default_commit_veto
    'sqlalchemy',
    'zope.sqlalchemy',
    'WebError',
pyramid/paster_templates/routesalchemy/development.ini_tmpl
@@ -11,8 +11,12 @@
[pipeline:main]
pipeline =
    egg:WebError#evalerror
    egg:repoze.tm2#tm
    {{project}}
    tm
    {{package}}
[filter:tm]
use = egg:repoze.tm2#tm
commit_veto = repoze.tm:default_commit_veto
[server:main]
use = egg:Paste#http
pyramid/paster_templates/routesalchemy/setup.py_tmpl
@@ -11,7 +11,7 @@
    'pyramid',
    'SQLAlchemy',
    'transaction',
    'repoze.tm2',
    'repoze.tm2>=1.0b1', # default_commit_veto
    'zope.sqlalchemy',
    'WebError',
    ]
pyramid/paster_templates/zodb/development.ini_tmpl
@@ -12,9 +12,13 @@
pipeline =
    egg:WebError#evalerror
    egg:repoze.zodbconn#closer
    egg:repoze.tm#tm
    tm
    {{project}}
[filter:tm]
use = egg:repoze.tm2#tm
commit_veto = repoze.tm:default_commit_veto
[server:main]
use = egg:Paste#http
host = 0.0.0.0
pyramid/paster_templates/zodb/setup.py_tmpl
@@ -9,7 +9,7 @@
requires = [
    'pyramid',
    'repoze.zodbconn',
    'repoze.tm',
    'repoze.tm2>=1.0b1', # default_commit_veto
    'ZODB3',
    'WebError',
    ]