Fixed #24359 -- Cleaned up docs/ref/exceptions.html
This commit is contained in:
parent
8a9f39d2b3
commit
2b19b3a031
|
@ -2,9 +2,7 @@
|
||||||
Django Exceptions
|
Django Exceptions
|
||||||
=================
|
=================
|
||||||
|
|
||||||
|
Django raises some of its own exceptions as well as standard Python exceptions.
|
||||||
Django raises some Django specific exceptions as well as many standard
|
|
||||||
Python exceptions.
|
|
||||||
|
|
||||||
Django Core Exceptions
|
Django Core Exceptions
|
||||||
======================
|
======================
|
||||||
|
@ -12,10 +10,11 @@ Django Core Exceptions
|
||||||
.. module:: django.core.exceptions
|
.. module:: django.core.exceptions
|
||||||
:synopsis: Django core exceptions
|
:synopsis: Django core exceptions
|
||||||
|
|
||||||
Django core exception classes are defined in :mod:`django.core.exceptions`.
|
Django core exception classes are defined in ``django.core.exceptions``.
|
||||||
|
|
||||||
|
``ObjectDoesNotExist`` and ``DoesNotExist``
|
||||||
|
-------------------------------------------
|
||||||
|
|
||||||
ObjectDoesNotExist and DoesNotExist
|
|
||||||
-----------------------------------
|
|
||||||
.. exception:: DoesNotExist
|
.. exception:: DoesNotExist
|
||||||
|
|
||||||
The ``DoesNotExist`` exception is raised when an object is not found for
|
The ``DoesNotExist`` exception is raised when an object is not found for
|
||||||
|
@ -33,8 +32,9 @@ ObjectDoesNotExist and DoesNotExist
|
||||||
See :meth:`~django.db.models.query.QuerySet.get()` for further information
|
See :meth:`~django.db.models.query.QuerySet.get()` for further information
|
||||||
on :exc:`ObjectDoesNotExist` and :exc:`DoesNotExist`.
|
on :exc:`ObjectDoesNotExist` and :exc:`DoesNotExist`.
|
||||||
|
|
||||||
FieldDoesNotExist
|
``FieldDoesNotExist``
|
||||||
-----------------
|
---------------------
|
||||||
|
|
||||||
.. exception:: FieldDoesNotExist
|
.. exception:: FieldDoesNotExist
|
||||||
|
|
||||||
The ``FieldDoesNotExist`` exception is raised by a model's
|
The ``FieldDoesNotExist`` exception is raised by a model's
|
||||||
|
@ -46,8 +46,9 @@ FieldDoesNotExist
|
||||||
This exception was previously defined only in
|
This exception was previously defined only in
|
||||||
``django.db.models.fields`` and wasn't part of the public API.
|
``django.db.models.fields`` and wasn't part of the public API.
|
||||||
|
|
||||||
MultipleObjectsReturned
|
``MultipleObjectsReturned``
|
||||||
-----------------------
|
---------------------------
|
||||||
|
|
||||||
.. exception:: MultipleObjectsReturned
|
.. exception:: MultipleObjectsReturned
|
||||||
|
|
||||||
The :exc:`MultipleObjectsReturned` exception is raised by a query if only
|
The :exc:`MultipleObjectsReturned` exception is raised by a query if only
|
||||||
|
@ -58,61 +59,66 @@ MultipleObjectsReturned
|
||||||
|
|
||||||
See :meth:`~django.db.models.query.QuerySet.get()` for further information.
|
See :meth:`~django.db.models.query.QuerySet.get()` for further information.
|
||||||
|
|
||||||
SuspiciousOperation
|
``SuspiciousOperation``
|
||||||
-------------------
|
-----------------------
|
||||||
|
|
||||||
.. exception:: SuspiciousOperation
|
.. exception:: SuspiciousOperation
|
||||||
|
|
||||||
The :exc:`SuspiciousOperation` exception is raised when a user has
|
The :exc:`SuspiciousOperation` exception is raised when a user has
|
||||||
performed an operation that should be considered suspicious from a security
|
performed an operation that should be considered suspicious from a security
|
||||||
perspective, such as tampering with a session cookie. Subclasses of
|
perspective, such as tampering with a session cookie. Subclasses of
|
||||||
SuspiciousOperation include:
|
``SuspiciousOperation`` include:
|
||||||
|
|
||||||
* DisallowedHost
|
* ``DisallowedHost``
|
||||||
* DisallowedModelAdminLookup
|
* ``DisallowedModelAdminLookup``
|
||||||
* DisallowedModelAdminToField
|
* ``DisallowedModelAdminToField``
|
||||||
* DisallowedRedirect
|
* ``DisallowedRedirect``
|
||||||
* InvalidSessionKey
|
* ``InvalidSessionKey``
|
||||||
* SuspiciousFileOperation
|
* ``SuspiciousFileOperation``
|
||||||
* SuspiciousMultipartForm
|
* ``SuspiciousMultipartForm``
|
||||||
* SuspiciousSession
|
* ``SuspiciousSession``
|
||||||
* WizardViewCookieModified
|
|
||||||
|
|
||||||
If a ``SuspiciousOperation`` exception reaches the WSGI handler level it is
|
If a ``SuspiciousOperation`` exception reaches the WSGI handler level it is
|
||||||
logged at the ``Error`` level and results in
|
logged at the ``Error`` level and results in
|
||||||
a :class:`~django.http.HttpResponseBadRequest`. See the :doc:`logging
|
a :class:`~django.http.HttpResponseBadRequest`. See the :doc:`logging
|
||||||
documentation </topics/logging/>` for more information.
|
documentation </topics/logging/>` for more information.
|
||||||
|
|
||||||
PermissionDenied
|
``PermissionDenied``
|
||||||
----------------
|
--------------------
|
||||||
|
|
||||||
.. exception:: PermissionDenied
|
.. exception:: PermissionDenied
|
||||||
|
|
||||||
The :exc:`PermissionDenied` exception is raised when a user does not have
|
The :exc:`PermissionDenied` exception is raised when a user does not have
|
||||||
permission to perform the action requested.
|
permission to perform the action requested.
|
||||||
|
|
||||||
ViewDoesNotExist
|
``ViewDoesNotExist``
|
||||||
----------------
|
--------------------
|
||||||
|
|
||||||
.. exception:: ViewDoesNotExist
|
.. exception:: ViewDoesNotExist
|
||||||
|
|
||||||
The :exc:`ViewDoesNotExist` exception is raised by
|
The :exc:`ViewDoesNotExist` exception is raised by
|
||||||
:mod:`django.core.urlresolvers` when a requested view does not exist.
|
:mod:`django.core.urlresolvers` when a requested view does not exist.
|
||||||
|
|
||||||
MiddlewareNotUsed
|
``MiddlewareNotUsed``
|
||||||
-----------------
|
---------------------
|
||||||
|
|
||||||
.. exception:: MiddlewareNotUsed
|
.. exception:: MiddlewareNotUsed
|
||||||
|
|
||||||
The :exc:`MiddlewareNotUsed` exception is raised when a middleware is not
|
The :exc:`MiddlewareNotUsed` exception is raised when a middleware is not
|
||||||
used in the server configuration.
|
used in the server configuration.
|
||||||
|
|
||||||
ImproperlyConfigured
|
``ImproperlyConfigured``
|
||||||
--------------------
|
------------------------
|
||||||
|
|
||||||
.. exception:: ImproperlyConfigured
|
.. exception:: ImproperlyConfigured
|
||||||
|
|
||||||
The :exc:`ImproperlyConfigured` exception is raised when Django is
|
The :exc:`ImproperlyConfigured` exception is raised when Django is
|
||||||
somehow improperly configured -- for example, if a value in ``settings.py``
|
somehow improperly configured -- for example, if a value in ``settings.py``
|
||||||
is incorrect or unparseable.
|
is incorrect or unparseable.
|
||||||
|
|
||||||
FieldError
|
``FieldError``
|
||||||
----------
|
--------------
|
||||||
|
|
||||||
.. exception:: FieldError
|
.. exception:: FieldError
|
||||||
|
|
||||||
The :exc:`FieldError` exception is raised when there is a problem with a
|
The :exc:`FieldError` exception is raised when there is a problem with a
|
||||||
|
@ -128,8 +134,9 @@ FieldError
|
||||||
- A field name is invalid
|
- A field name is invalid
|
||||||
- A query contains invalid order_by arguments
|
- A query contains invalid order_by arguments
|
||||||
|
|
||||||
ValidationError
|
``ValidationError``
|
||||||
---------------
|
-------------------
|
||||||
|
|
||||||
.. exception:: ValidationError
|
.. exception:: ValidationError
|
||||||
|
|
||||||
The :exc:`ValidationError` exception is raised when data fails form or
|
The :exc:`ValidationError` exception is raised when data fails form or
|
||||||
|
@ -138,8 +145,9 @@ ValidationError
|
||||||
:ref:`Model Field Validation <validating-objects>` and the
|
:ref:`Model Field Validation <validating-objects>` and the
|
||||||
:doc:`Validator Reference </ref/validators>`.
|
:doc:`Validator Reference </ref/validators>`.
|
||||||
|
|
||||||
NON_FIELD_ERRORS
|
``NON_FIELD_ERRORS``
|
||||||
~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
.. data:: NON_FIELD_ERRORS
|
.. data:: NON_FIELD_ERRORS
|
||||||
|
|
||||||
``ValidationError``\s that don't belong to a particular field in a form
|
``ValidationError``\s that don't belong to a particular field in a form
|
||||||
|
@ -152,19 +160,21 @@ list of errors.
|
||||||
URL Resolver exceptions
|
URL Resolver exceptions
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
URL Resolver exceptions are defined in :mod:`django.core.urlresolvers`.
|
URL Resolver exceptions are defined in ``django.core.urlresolvers``.
|
||||||
|
|
||||||
|
``Resolver404``
|
||||||
|
---------------
|
||||||
|
|
||||||
Resolver404
|
|
||||||
--------------
|
|
||||||
.. exception:: Resolver404
|
.. exception:: Resolver404
|
||||||
|
|
||||||
The :exc:`Resolver404` exception is raised by
|
The :exc:`Resolver404` exception is raised by
|
||||||
:func:`django.core.urlresolvers.resolve()` if the path passed to
|
:func:`django.core.urlresolvers.resolve()` if the path passed to
|
||||||
``resolve()`` doesn't map to a view. It's a subclass of
|
``resolve()`` doesn't map to a view. It's a subclass of
|
||||||
:class:`django.http.Http404`
|
:class:`django.http.Http404`.
|
||||||
|
|
||||||
|
``NoReverseMatch``
|
||||||
|
------------------
|
||||||
|
|
||||||
NoReverseMatch
|
|
||||||
--------------
|
|
||||||
.. exception:: NoReverseMatch
|
.. exception:: NoReverseMatch
|
||||||
|
|
||||||
The :exc:`NoReverseMatch` exception is raised by
|
The :exc:`NoReverseMatch` exception is raised by
|
||||||
|
@ -176,7 +186,7 @@ NoReverseMatch
|
||||||
Database Exceptions
|
Database Exceptions
|
||||||
===================
|
===================
|
||||||
|
|
||||||
Database exceptions are provided in :mod:`django.db`.
|
Database exceptions may be imported from ``django.db``.
|
||||||
|
|
||||||
Django wraps the standard database exceptions so that your Django code has a
|
Django wraps the standard database exceptions so that your Django code has a
|
||||||
guaranteed common implementation of these classes.
|
guaranteed common implementation of these classes.
|
||||||
|
@ -212,22 +222,28 @@ of :exc:`IntegrityError`.
|
||||||
Http Exceptions
|
Http Exceptions
|
||||||
===============
|
===============
|
||||||
|
|
||||||
Http exceptions are provided in :mod:`django.http`.
|
Http exceptions may be imported from ``django.http``.
|
||||||
|
|
||||||
|
``UnreadablePostError``
|
||||||
|
-----------------------
|
||||||
|
|
||||||
.. exception:: UnreadablePostError
|
.. exception:: UnreadablePostError
|
||||||
|
|
||||||
The :exc:`UnreadablePostError` is raised when a user cancels an upload.
|
:exc:`UnreadablePostError` is raised when a user cancels an upload.
|
||||||
|
|
||||||
.. currentmodule:: django.db.transaction
|
|
||||||
|
|
||||||
Transaction Exceptions
|
Transaction Exceptions
|
||||||
======================
|
======================
|
||||||
|
|
||||||
Transaction exceptions are defined in :mod:`django.db.transaction`.
|
.. currentmodule:: django.db.transaction
|
||||||
|
|
||||||
|
Transaction exceptions are defined in ``django.db.transaction``.
|
||||||
|
|
||||||
|
``TransactionManagementError``
|
||||||
|
------------------------------
|
||||||
|
|
||||||
.. exception:: TransactionManagementError
|
.. exception:: TransactionManagementError
|
||||||
|
|
||||||
The :exc:`TransactionManagementError` is raised for any and all problems
|
:exc:`TransactionManagementError` is raised for any and all problems
|
||||||
related to database transactions.
|
related to database transactions.
|
||||||
|
|
||||||
.. currentmodule:: django.test
|
.. currentmodule:: django.test
|
||||||
|
@ -235,7 +251,10 @@ Transaction exceptions are defined in :mod:`django.db.transaction`.
|
||||||
Testing Framework Exceptions
|
Testing Framework Exceptions
|
||||||
============================
|
============================
|
||||||
|
|
||||||
Exceptions provided by the :mod:`django.test` package.
|
Exceptions provided by the ``django.test`` package.
|
||||||
|
|
||||||
|
``RedirectCycleError``
|
||||||
|
----------------------
|
||||||
|
|
||||||
.. exception:: client.RedirectCycleError
|
.. exception:: client.RedirectCycleError
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue