Skip to content

Commit

Permalink
Merge pull request #836 from davidjb/public-predicate-mismatch
Browse files Browse the repository at this point in the history
Document PredicateMismatch for exception contexts
  • Loading branch information
mcdonc committed Feb 10, 2013
2 parents 38db078 + 4d059a7 commit 65cf215
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
2 changes: 2 additions & 0 deletions docs/api/exceptions.rst
Expand Up @@ -5,6 +5,8 @@


.. automodule:: pyramid.exceptions .. automodule:: pyramid.exceptions


.. autoclass:: PredicateMismatch

.. autoclass:: Forbidden .. autoclass:: Forbidden


.. autoclass:: NotFound .. autoclass:: NotFound
Expand Down
28 changes: 23 additions & 5 deletions pyramid/exceptions.py
Expand Up @@ -10,11 +10,29 @@


class PredicateMismatch(HTTPNotFound): class PredicateMismatch(HTTPNotFound):
""" """
Internal exception (not an API) raised by multiviews when no This exception is raised by multiviews when no view matches
view matches. This exception subclasses the ``NotFound`` all given predicates.
exception only one reason: if it reaches the main exception
handler, it should be treated like a ``NotFound`` by any exception This exception subclasses the :class:`HTTPNotFound` exception for a
view registrations. specific reason: if it reaches the main exception handler, it should
be treated as :class:`HTTPNotFound`` by any exception view
registrations. Thus, typically, this exception will not be seen
publicly.
However, this exception will be raised if the predicates of all
views configured to handle another exception context cannot be
successfully matched. For instance, if a view is configured to
handle a context of ``HTTPForbidden`` and the configured with
additional predicates, then :class:`PredicateMismatch` will be
raised if:
* An original view callable has raised :class:`HTTPForbidden` (thus
invoking an exception view); and
* The given request fails to match all predicates for said
exception view associated with :class:`HTTPForbidden`.
The same applies to any type of exception being handled by an
exception view.
""" """


class URLDecodeError(UnicodeDecodeError): class URLDecodeError(UnicodeDecodeError):
Expand Down

0 comments on commit 65cf215

Please sign in to comment.