diff options
| author | Chris McDonough <chrism@plope.com> | 2011-06-21 02:18:19 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2011-06-21 02:18:19 -0400 |
| commit | c724f039d58f2c126594b7a644a0de1b97e17910 (patch) | |
| tree | 2aeab8be28041d84fe3e114e0a7f3ef214cd603b | |
| parent | 83549e631fe28e8e3b0b0274d0e631f1ebebd205 (diff) | |
| download | pyramid-c724f039d58f2c126594b7a644a0de1b97e17910.tar.gz pyramid-c724f039d58f2c126594b7a644a0de1b97e17910.tar.bz2 pyramid-c724f039d58f2c126594b7a644a0de1b97e17910.zip | |
- The pyramid Router attempted to set a value into the key
``environ['repoze.bfg.message']`` when it caught a view-related exception
for backwards compatibility with :mod:`repoze.bfg` during error handling.
It did this by using code that looked like so::
# "why" is an exception object
try:
msg = why[0]
except:
msg = ''
environ['repoze.bfg.message'] = msg
Use of the value ``environ['repoze.bfg.message']`` was docs-deprecated in
Pyramid 1.0. Our standing policy is to not remove features after a
deprecation for two full major releases, so this code was originally slated
to be removed in Pyramid 1.2. However, computing the
``repoze.bfg.message`` value was the source of at least one bug found in
the wild (https://github.com/Pylons/pyramid/issues/199), and there isn't a
foolproof way to both preserve backwards compatibility and to fix the bug.
Therefore, the code which sets the value has been removed in this release.
Code in exception views which relies on this value's presence in the
environment should now use the ``exception`` attribute of the request
(e.g. ``request.exception[0]``) to retrieve the message instead of relying
on ``request.environ['repoze.bfg.message']``.
Closes #199.
| -rw-r--r-- | CHANGES.txt | 32 | ||||
| -rw-r--r-- | pyramid/router.py | 8 |
2 files changed, 32 insertions, 8 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 413f76729..29d3d472c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,35 @@ +Next release +============ + +Backwards Incompatibilities +--------------------------- + +- The pyramid Router attempted to set a value into the key + ``environ['repoze.bfg.message']`` when it caught a view-related exception + for backwards compatibility with :mod:`repoze.bfg` during error handling. + It did this by using code that looked like so:: + + # "why" is an exception object + try: + msg = why[0] + except: + msg = '' + + environ['repoze.bfg.message'] = msg + + Use of the value ``environ['repoze.bfg.message']`` was docs-deprecated in + Pyramid 1.0. Our standing policy is to not remove features after a + deprecation for two full major releases, so this code was originally slated + to be removed in Pyramid 1.2. However, computing the + ``repoze.bfg.message`` value was the source of at least one bug found in + the wild (https://github.com/Pylons/pyramid/issues/199), and there isn't a + foolproof way to both preserve backwards compatibility and to fix the bug. + Therefore, the code which sets the value has been removed in this release. + Code in exception views which relies on this value's presence in the + environment should now use the ``exception`` attribute of the request + (e.g. ``request.exception[0]``) to retrieve the message instead of relying + on ``request.environ['repoze.bfg.message']``. + 1.1a1 (2011-06-20) ================== diff --git a/pyramid/router.py b/pyramid/router.py index 8e33332df..ef04497f9 100644 --- a/pyramid/router.py +++ b/pyramid/router.py @@ -170,14 +170,6 @@ class Router(object): if view_callable is None: raise - try: - msg = why[0] - except: - msg = '' - - # repoze.bfg.message docs-deprecated in Pyramid 1.0 - environ['repoze.bfg.message'] = msg - result = view_callable(why, request) # process the response |
