summaryrefslogtreecommitdiff
path: root/repoze/bfg/exceptions.py
AgeCommit message (Collapse)Author
2010-10-25first pass at converting bfg to pyramid namespaceChris McDonough
2010-08-08- New public interface: ``repoze.bfg.exceptions.IExceptionResponse``.Chris McDonough
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`` (undoes previous custom_notfound_view on request passsed to append_slash_notfound_view). - 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.
2010-07-21- A new internal exception class (*not* an API) namedChris McDonough
``repoze.bfg.exceptions.PredicateMismatch`` now exists. This exception is currently raised when no constituent view of a multiview can be called (due to no predicate match). Previously, in this situation, a ``repoze.bfg.exceptions.NotFound`` was raised. We provide backwards compatibility for code that expected a ``NotFound`` to be raised when no predicates match by causing ``repoze.bfg.exceptions.PredicateMismatch`` to inherit from ``NotFound``. This will cause any exception view registered for ``NotFound`` to be called when a predicate mismatch occurs, as was the previous behavior. There is however, one perverse case that will expose a backwards incompatibility. If 1) you had a view that was registered as a member of a multiview 2) this view explicitly raised a ``NotFound`` exception *in order to* proceed to the next predicate check in the multiview, that code will now behave differently: rather than skipping to the next view match, a NotFound will be raised to the top-level exception handling machinery instead. For code to be depending upon the behavior of a view raising ``NotFound`` to proceed to the next predicate match, would be tragic, but not impossible, given that ``NotFound`` is a public interface. ``repoze.bfg.exceptions.PredicateMismatch`` is not a public API and cannot be depended upon by application code, so you should not change your view code to raise ``PredicateMismatch``. Instead, move the logic which raised the ``NotFound`` exception in the view out into a custom view predicate.
2010-07-12- New internal exception: ``repoze.bfg.exceptions.URLDecodeError``.Chris McDonough
This URL is a subclass of the built-in Python exception named ``UnicodeDecodeError``. - When decoding a URL segment to Unicode fails, the exception raised is now ``repoze.bfg.exceptions.URLDecodeError`` instead of ``UnicodeDecodeError``. This makes it possible to register an exception view invoked specifically when ``repoze.bfg`` cannot decode a URL.
2010-04-25Make default_notfound_view and default_forbidden_view expect an exception asChris McDonough
a context. Cause append_slash_notfound_view to work in case it is registered via set_notfound_view.
2009-12-24Roles.Chris McDonough
2009-12-09- The exception class representing the error raised by various methodsChris McDonough
of a ``Configurator`` is now importable as ``repoze.bfg.exceptions.ConfigurationError``.
2009-10-23Remove 'Respond' exception (its addition would be purely speculative: we ↵Chris McDonough
solved the reissue_time authentication policy issue a different way).
2009-10-21Add Respond exception.Chris McDonough
2009-09-30- The import of ``repoze.bfg.view.NotFound`` is deprecated in favor ofChris McDonough
``repoze.bfg.exceptions.NotFound``. The old location still functions, but emits a deprecation warning. - The import of ``repoze.bfg.security.Unauthorized`` is deprecated in favor of ``repoze.bfg.exceptions.Forbidden``. The old location still functions but emits a deprecation warning. The rename from ``Unauthorized`` to ``Forbidden`` brings parity to the the name of the exception and the system view it invokes when raised. - New ``repoze.bfg.exceptions`` module was created to house exceptions that were previously sprinkled through various modules. - An ``exceptions`` API chapter was added, documenting the new ``repoze.bfg.exceptions`` module.