From ab27bdb42d5b2c525466fe5570959f66b4814326 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 7 Aug 2010 04:41:40 +0000 Subject: 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. --- CHANGES.txt | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'CHANGES.txt') 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) ================== -- cgit v1.2.3