repoze.bfg 1.3a8 has been released.

Install it via:

   easy_install -i repoze.bfg

Or via PyPI.

This is a minor feature release.  The changelog follows.

1.3a8 (2010-08-08)


- New public interface: ``repoze.bfg.exceptions.IExceptionResponse``.
  This interface is provided by all internal exception classes (such
  as ``repoze.bfg.exceptions.NotFound`` and
  ``repoze.bfg.exceptions.Forbidden``), instances of which are both
  exception objects and can behave as WSGI response objects.  This
  interface is made public so that exception classes which are also
  valid WSGI response factories can be configured to implement them or
  exception instances which are also or response instances can be
  configured to provide them.

- New API class: ``repoze.bfg.view.AppendSlashNotFoundViewFactory``.

  There can only be one Not Found view in any ``repoze.bfg``
  application.  Even if you use
  ``repoze.bfg.view.append_slash_notfound_view`` as the Not Found
  view, ``repoze.bfg`` still must generate a ``404 Not Found``
  response when it cannot redirect to a slash-appended URL; this not
  found response will be visible to site users.

  If you don't care what this 404 response looks like, and you only
  need redirections to slash-appended route URLs, you may use the
  ``repoze.bfg.view.append_slash_notfound_view`` object as the Not
  Found view.  However, if you wish to use a *custom* notfound view
  callable when a URL cannot be redirected to a slash-appended URL,
  you may wish to use an instance of the
  ``repoze.bfg.view.AppendSlashNotFoundViewFactory`` class as the Not
  Found view, supplying the notfound view callable as the first
  argument to its constructor.  For instance::

       from repoze.bfg.exceptions import NotFound
       from repoze.bfg.view import AppendSlashNotFoundViewFactory

       def notfound_view(context, request):
           return HTTPNotFound('It aint there, stop trying!')

       custom_append_slash =
       config.add_view(custom_append_slash, context=NotFound)

  The ``notfound_view`` supplied must adhere to the two-argument view
  callable calling convention of ``(context, request)`` (``context``
  will be the exception object).


- 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.


- Previously, two default view functions were registered at
  Configurator setup (one for ``repoze.bfg.exceptions.NotFound`` named
  ``default_notfound_view`` and one for
  ``repoze.bfg.exceptions.Forbidden`` named
  ``default_forbidden_view``) to render internal exception responses.
  Those default view functions have been removed, replaced with a
  generic default view function which is registered at Configurator
  setup for the ``repoze.bfg.interfaces.IExceptionResponse`` interface
  that simply returns the exception instance; the ``NotFound`` and
  ``Forbidden`` classes are now still exception factories but they are
  also response factories which generate instances that implement the
  new ``repoze.bfg.interfaces.IExceptionResponse`` interface.

Repoze-dev mailing list

Reply via email to