diff options
| author | Claude Paroz <claude@2xlibre.net> | 2012-06-09 17:55:24 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2012-06-09 17:55:24 +0200 |
| commit | fc40a6504b78e604a6ba90a3b85b1ed54ee238a2 (patch) | |
| tree | 0cfbd2389dca6b2bd24910cdd315023dfc13586d /docs | |
| parent | ef906b163202679413f1fdae7106b8de86477dbe (diff) | |
Fixed #17159 -- Validated returned number of next|previous_page_number
Thanks mehta.apurva at gmail.com for the report and the initial patch
and neaf for the complete patch.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/releases/1.5.txt | 10 | ||||
| -rw-r--r-- | docs/topics/pagination.txt | 14 |
2 files changed, 20 insertions, 4 deletions
diff --git a/docs/releases/1.5.txt b/docs/releases/1.5.txt index 6512560b50..3e274b5d98 100644 --- a/docs/releases/1.5.txt +++ b/docs/releases/1.5.txt @@ -154,6 +154,16 @@ Unicode parameters (``password``, ``salt`` or ``encoded``). If any of the hashing methods need byte strings, you can use the :func:`~django.utils.encoding.smart_str` utility to encode the strings. +Validation of previous_page_number and next_page_number +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +When using :doc:`object pagination </topics/pagination>`, +the ``previous_page_number()`` and ``next_page_number()`` methods of the +:class:`~django.core.paginator.Page` object did not check if the returned +number was inside the existing page range. +It does check it now and raises an :exc:`InvalidPage` exception when the number +is either too low or too high. + Features deprecated in 1.5 ========================== diff --git a/docs/topics/pagination.txt b/docs/topics/pagination.txt index 566319ff0a..72560469a8 100644 --- a/docs/topics/pagination.txt +++ b/docs/topics/pagination.txt @@ -253,13 +253,19 @@ Methods .. method:: Page.next_page_number() - Returns the next page number. Note that this is "dumb" and will return the - next page number regardless of whether a subsequent page exists. + Returns the next page number. + + .. versionchanged:: 1.5 + + Raises :exc:`InvalidPage` if next page doesn't exist. .. method:: Page.previous_page_number() - Returns the previous page number. Note that this is "dumb" and will return - the previous page number regardless of whether a previous page exists. + Returns the previous page number. + + .. versionchanged:: 1.5 + + Raises :exc:`InvalidPage` if previous page doesn't exist. .. method:: Page.start_index() |
