summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2008-07-08 02:20:48 +0000
committerAdrian Holovaty <adrian@holovaty.com>2008-07-08 02:20:48 +0000
commita724fff300671ffa78f08158d7e11281cd0a4fd1 (patch)
tree3e3866f52c6eeb164013b7dfe48a2b0615f54796 /docs
parentcb70c9953795484451fe26094578285d4b39d5e5 (diff)
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
Diffstat (limited to 'docs')
-rw-r--r--docs/pagination.txt15
1 files changed, 15 insertions, 0 deletions
diff --git a/docs/pagination.txt b/docs/pagination.txt
index 20c6ca84cc..bfdf8eea1c 100644
--- a/docs/pagination.txt
+++ b/docs/pagination.txt
@@ -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
================