mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #7307 -- Split InvalidPage exception into two subclasses, PageNotAnInteger and EmptyPage, for granular exception catching. Thanks for the idea, miracle2k
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7867 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -82,6 +82,21 @@ Attributes
|
||||
|
||||
``page_range`` -- A 1-based range of page numbers, e.g., ``[1, 2, 3, 4]``.
|
||||
|
||||
``InvalidPage`` exceptions
|
||||
==========================
|
||||
|
||||
The ``page()`` method raises ``InvalidPage`` if the requested page is invalid
|
||||
(i.e., not an integer) or contains no objects. Generally, it's enough to trap
|
||||
the ``InvalidPage`` exception, but if you'd like more granularity, you can trap
|
||||
either of the following exceptions:
|
||||
|
||||
``PageNotAnInteger`` -- Raised when ``page()`` is given a value that isn't an integer.
|
||||
|
||||
``EmptyPage`` -- Raised when ``page()`` is given a valid value but no objects exist on that page.
|
||||
|
||||
Both of the exceptions are subclasses of ``InvalidPage``, so you can handle
|
||||
them both with a simple ``except InvalidPage``.
|
||||
|
||||
``Page`` objects
|
||||
================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user