summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-01-19 21:34:19 -0500
committerChris McDonough <chrism@plope.com>2011-01-19 21:34:19 -0500
commit607d756e962dce912134e075dbcc5f11a91987f0 (patch)
tree24ff54af4402c52da8ad34bc8fbbf889dd69e24b
parent36a3bf111cae15ff46d0769ccfb2edc1ecf050d3 (diff)
downloadpyramid-607d756e962dce912134e075dbcc5f11a91987f0.tar.gz
pyramid-607d756e962dce912134e075dbcc5f11a91987f0.tar.bz2
pyramid-607d756e962dce912134e075dbcc5f11a91987f0.zip
- 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.
-rw-r--r--CHANGES.txt10
-rw-r--r--TODO.txt3
-rw-r--r--docs/tutorials/wiki/basiclayout.rst8
-rw-r--r--pyramid/paster_templates/alchemy/development.ini_tmpl6
-rw-r--r--pyramid/paster_templates/alchemy/setup.py_tmpl2
-rw-r--r--pyramid/paster_templates/routesalchemy/development.ini_tmpl8
-rw-r--r--pyramid/paster_templates/routesalchemy/setup.py_tmpl2
-rw-r--r--pyramid/paster_templates/zodb/development.ini_tmpl6
-rw-r--r--pyramid/paster_templates/zodb/setup.py_tmpl2
9 files changed, 34 insertions, 13 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 86473b9b3..416de00f9 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -35,6 +35,16 @@ Backwards Incompatibilities
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)
===================
diff --git a/TODO.txt b/TODO.txt
index 75dc5199f..e34c2fe55 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -6,9 +6,6 @@ Must-Have (before 1.0)
- 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,
diff --git a/docs/tutorials/wiki/basiclayout.rst b/docs/tutorials/wiki/basiclayout.rst
index 4017d7af8..884f17840 100644
--- a/docs/tutorials/wiki/basiclayout.rst
+++ b/docs/tutorials/wiki/basiclayout.rst
@@ -187,9 +187,11 @@ The ``egg:repoze.zodbconn#closer`` middleware is in the middle of the
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]``
diff --git a/pyramid/paster_templates/alchemy/development.ini_tmpl b/pyramid/paster_templates/alchemy/development.ini_tmpl
index bf672ef1d..619b193dc 100644
--- a/pyramid/paster_templates/alchemy/development.ini_tmpl
+++ b/pyramid/paster_templates/alchemy/development.ini_tmpl
@@ -11,9 +11,13 @@ sqlalchemy.url = sqlite:///%(here)s/{{project}}.db
[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
diff --git a/pyramid/paster_templates/alchemy/setup.py_tmpl b/pyramid/paster_templates/alchemy/setup.py_tmpl
index 591b57d9d..8e9da9755 100644
--- a/pyramid/paster_templates/alchemy/setup.py_tmpl
+++ b/pyramid/paster_templates/alchemy/setup.py_tmpl
@@ -9,7 +9,7 @@ CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
requires = [
'pyramid',
- 'repoze.tm2',
+ 'repoze.tm2>=1.0b1', # default_commit_veto
'sqlalchemy',
'zope.sqlalchemy',
'WebError',
diff --git a/pyramid/paster_templates/routesalchemy/development.ini_tmpl b/pyramid/paster_templates/routesalchemy/development.ini_tmpl
index b79dfccfe..7f1d6af9b 100644
--- a/pyramid/paster_templates/routesalchemy/development.ini_tmpl
+++ b/pyramid/paster_templates/routesalchemy/development.ini_tmpl
@@ -11,8 +11,12 @@ sqlalchemy.url = sqlite:///%(here)s/{{project}}.db
[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
diff --git a/pyramid/paster_templates/routesalchemy/setup.py_tmpl b/pyramid/paster_templates/routesalchemy/setup.py_tmpl
index 80b756214..936a5dde0 100644
--- a/pyramid/paster_templates/routesalchemy/setup.py_tmpl
+++ b/pyramid/paster_templates/routesalchemy/setup.py_tmpl
@@ -11,7 +11,7 @@ requires = [
'pyramid',
'SQLAlchemy',
'transaction',
- 'repoze.tm2',
+ 'repoze.tm2>=1.0b1', # default_commit_veto
'zope.sqlalchemy',
'WebError',
]
diff --git a/pyramid/paster_templates/zodb/development.ini_tmpl b/pyramid/paster_templates/zodb/development.ini_tmpl
index 110d514e6..0a88094b3 100644
--- a/pyramid/paster_templates/zodb/development.ini_tmpl
+++ b/pyramid/paster_templates/zodb/development.ini_tmpl
@@ -12,9 +12,13 @@ zodb_uri = file://%(here)s/Data.fs?connection_cache_size=20000
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
diff --git a/pyramid/paster_templates/zodb/setup.py_tmpl b/pyramid/paster_templates/zodb/setup.py_tmpl
index cd1de15de..a6ef572ac 100644
--- a/pyramid/paster_templates/zodb/setup.py_tmpl
+++ b/pyramid/paster_templates/zodb/setup.py_tmpl
@@ -9,7 +9,7 @@ CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
requires = [
'pyramid',
'repoze.zodbconn',
- 'repoze.tm',
+ 'repoze.tm2>=1.0b1', # default_commit_veto
'ZODB3',
'WebError',
]