diff options
| author | Chris McDonough <chrism@agendaless.com> | 2010-08-07 04:41:40 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2010-08-07 04:41:40 +0000 |
| commit | ab27bdb42d5b2c525466fe5570959f66b4814326 (patch) | |
| tree | e845ef721f21e4b651cd5bfcd32564ff18525855 /CHANGES.txt | |
| parent | a48be71bca1caec1082061430f5787a0ebf7c249 (diff) | |
| download | pyramid-ab27bdb42d5b2c525466fe5570959f66b4814326.tar.gz pyramid-ab27bdb42d5b2c525466fe5570959f66b4814326.tar.bz2 pyramid-ab27bdb42d5b2c525466fe5570959f66b4814326.zip | |
Features
--------
- There can only be one Not Found view in any ``repoze.bfg``
application. If you use
``repoze.bfg.view.append_slash_notfound_view`` as the Not Found
view, it still must generate a NotFound response when it cannot
redirect to a slash-appended URL; this not found response will be
visible to site users.
As of this release, if you wish to use a custom notfound view
callable when ``append_slash_notfound_view`` does not redirect to a
slash-appended URL, use a wrapper function as the
``repoze.bfg.exceptions.NotFound`` view; have this wrapper attach a
view callable which returns a response to the request object named
``custom_notfound_view`` before calling
``append_slash_notfound_view``. For example::
from webob.exc import HTTPNotFound
from repoze.bfg.exceptions import NotFound
from repoze.bfg.view import append_slash_notfound_view
def notfound_view(exc, request):
def fallback_notfound_view(exc, request):
return HTTPNotFound('It aint there, stop trying!')
request.fallback_notfound_view = fallback_notfound_view
return append_slash_notfound_view(exc, request)
config.add_view(notfound_view, context=NotFound)
``custom_notfound_view`` must adhere to the two-argument view
callable calling convention of ``(context, request)`` (``context``
will be the exception object).
If ``custom_notfound_view`` is not found on the request object, a
default notfound response will be generated when the
``append_slash_notfound_view`` doesn't redirect to a slash-appended
URL.
Documentation
--------------
- Expanded the "Cleaning Up After a Request" section of the URL
Dispatch narrative chapter.
- Expanded the "Redirecting to Slash-Appended Routes" section of the
URL Dispatch narrative chapter.
Diffstat (limited to 'CHANGES.txt')
| -rw-r--r-- | CHANGES.txt | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 1c62b25ff..65a08a781 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,54 @@ +Next release +============ + +Features +-------- + +- There can only be one Not Found view in any ``repoze.bfg`` + application. If you use + ``repoze.bfg.view.append_slash_notfound_view`` as the Not Found + view, it still must generate a NotFound response when it cannot + redirect to a slash-appended URL; this not found response will be + visible to site users. + + As of this release, if you wish to use a custom notfound view + callable when ``append_slash_notfound_view`` does not redirect to a + slash-appended URL, use a wrapper function as the + ``repoze.bfg.exceptions.NotFound`` view; have this wrapper attach a + view callable which returns a response to the request object named + ``custom_notfound_view`` before calling + ``append_slash_notfound_view``. For example:: + + from webob.exc import HTTPNotFound + from repoze.bfg.exceptions import NotFound + from repoze.bfg.view import append_slash_notfound_view + + def notfound_view(exc, request): + def fallback_notfound_view(exc, request): + return HTTPNotFound('It aint there, stop trying!') + request.fallback_notfound_view = fallback_notfound_view + return append_slash_notfound_view(exc, request) + + config.add_view(notfound_view, context=NotFound) + + ``custom_notfound_view`` must adhere to the two-argument view + callable calling convention of ``(context, request)`` (``context`` + will be the exception object). + + If ``custom_notfound_view`` is not found on the request object, a + default notfound response will be generated when the + ``append_slash_notfound_view`` doesn't redirect to a slash-appended + URL. + +Documentation +-------------- + +- Expanded the "Cleaning Up After a Request" section of the URL + Dispatch narrative chapter. + +- Expanded the "Redirecting to Slash-Appended Routes" section of the + URL Dispatch narrative chapter. + 1.3a7 (2010-08-01) ================== |
