summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.txt5
-rw-r--r--docs/api/exceptions.rst2
-rw-r--r--docs/api/httpexceptions.rst13
-rw-r--r--pyramid/httpexceptions.py17
4 files changed, 14 insertions, 23 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index a228fbb3a..fcfb83e4f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -10,6 +10,11 @@ Features
python -3 -m pyramid.scripts.pserve development.ini
+- Added a specific subclass of ``HTTPBadRequest`` named
+ ``pyramid.exceptions.BadCSRFToken`` which will now be raised in response
+ to failures in ``check_csrf_token``.
+ See https://github.com/Pylons/pyramid/pull/1149
+
Bug Fixes
---------
diff --git a/docs/api/exceptions.rst b/docs/api/exceptions.rst
index ab158f18d..0c630571f 100644
--- a/docs/api/exceptions.rst
+++ b/docs/api/exceptions.rst
@@ -5,6 +5,8 @@
.. automodule:: pyramid.exceptions
+ .. autoclass:: BadCSRFToken
+
.. autoclass:: PredicateMismatch
.. autoclass:: Forbidden
diff --git a/docs/api/httpexceptions.rst b/docs/api/httpexceptions.rst
index 0fdd0f0e9..b50f10beb 100644
--- a/docs/api/httpexceptions.rst
+++ b/docs/api/httpexceptions.rst
@@ -10,9 +10,6 @@
A mapping of integer status code to HTTP exception class (eg. the integer
"401" maps to :class:`pyramid.httpexceptions.HTTPUnauthorized`). All
mapped exception classes are children of :class:`pyramid.httpexceptions`,
- i.e. the :ref:`pyramid_specific_http_exceptions` such as
- :class:`pyramid.httpexceptions.HTTPBadRequest.BadCSRFToken` are not
- mapped.
.. autofunction:: exception_response
@@ -109,13 +106,3 @@
.. autoclass:: HTTPVersionNotSupported
.. autoclass:: HTTPInsufficientStorage
-
-
-.. _pyramid_specific_http_exceptions:
-
-Pyramid-specific HTTP Exceptions
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Each Pyramid-specific HTTP exception has the status code of it's parent.
-
- .. autoclass:: HTTPBadCSRFToken
diff --git a/pyramid/httpexceptions.py b/pyramid/httpexceptions.py
index 5e8d8ccd8..ebee39ada 100644
--- a/pyramid/httpexceptions.py
+++ b/pyramid/httpexceptions.py
@@ -2,13 +2,10 @@
HTTP Exceptions
---------------
-This module contains Pyramid HTTP exception classes. Each class is a subclass
-of the :class:`~HTTPException`. Each class relates to a single HTTP status
-code, although the reverse is not true. There are
-:ref:`pyramid_specific_http_exceptions` which are sub-classes of the
-:rfc:`2608` HTTP status codes. Each of these Pyramid-specific exceptions have
-the status code of it's parent. Each exception class is also a
-:term:`response` object.
+This module contains Pyramid HTTP exception classes. Each class relates to a
+single HTTP status code. Each class is a subclass of the
+:class:`~HTTPException`. Each exception class is also a :term:`response`
+object.
Each exception class has a status code according to :rfc:`2068`:
codes with 100-300 are not really errors; 400s are client errors,
@@ -571,10 +568,10 @@ class HTTPBadRequest(HTTPClientError):
"""
subclass of :class:`~HTTPClientError`
- base class for Pyramid-specific validity checks of the client's request
+ This indicates that the body or headers failed validity checks,
+ preventing the server from being able to continue processing.
- This class and it's sub-classes result in a '400 Bad Request' HTTP status,
- although it's sub-classes specialize the 'Bad Request' text.
+ code: 400, title: Bad Request
"""
pass