From d75fe70228c89e3606e51a4d5775faf549252a90 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 30 Sep 2009 03:27:28 +0000 Subject: - The import of ``repoze.bfg.view.NotFound`` is deprecated in favor of ``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. --- repoze/bfg/exceptions.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 repoze/bfg/exceptions.py (limited to 'repoze/bfg/exceptions.py') diff --git a/repoze/bfg/exceptions.py b/repoze/bfg/exceptions.py new file mode 100644 index 000000000..afd617a2c --- /dev/null +++ b/repoze/bfg/exceptions.py @@ -0,0 +1,24 @@ +class Forbidden(Exception): + """\ + Raise this exception within :term:`view` code to immediately + return the Forbidden view to the invoking user. Usually this is a + basic ``401`` page, but the Forbidden view can be customized as + necessary. See :ref:`changing_the_forbidden_view`. + + This exception's constructor accepts a single positional argument, + which should be a string. The value of this string will be placed + into the WSGI environment under the ``repoze.bfg.message`` key, + for availability to the Forbidden view.""" + +class NotFound(Exception): + """\ + Raise this exception within :term:`view` code to immediately + return the Not Found view to the invoking user. Usually this is a + basic ``404`` page, but the Not Found view can be customized as + necessary. See :ref:`changing_the_notfound_view`. + + This exception's constructor accepts a single positional argument, + which should be a string. The value of this string will be placed + into the WSGI environment under the ``repoze.bfg.message`` key, + for availability to the Not Found view.""" + -- cgit v1.2.3