Mercurial > public > sg101
changeset 1238:db7a0f69e29a modernize tip
Get paginator doctests working again.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 08 Jun 2025 15:37:05 -0500 |
parents | f2f94d58b03b |
children | |
files | core/paginator.py |
diffstat | 1 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/core/paginator.py Sun Jun 08 15:14:11 2025 -0500 +++ b/core/paginator.py Sun Jun 08 15:37:05 2025 -0500 @@ -6,13 +6,16 @@ http://blog.elsdoerfer.name/2008/03/06/yet-another-paginator-digg-style/ """ import math -from django.core.paginator import \ - Paginator, QuerySetPaginator, Page, InvalidPage +from django.core.paginator import ( + Paginator, QuerySetPaginator, Page, InvalidPage, EmptyPage, + PageNotAnInteger) __all__ = ( + 'DiggPaginator', + 'EmptyPage', + 'ExPaginator', 'InvalidPage', - 'ExPaginator', - 'DiggPaginator', + 'PageNotAnInteger', 'QuerySetDiggPaginator', ) @@ -30,14 +33,14 @@ >>> paginator = ExPaginator(items, 10) >>> paginator.page(1000) Traceback (most recent call last): - InvalidPage: That page contains no results + EmptyPage: That page contains no results >>> paginator.page(1000, softlimit=True) <Page 100 of 100> # [bug] graceful handling of non-int args >>> paginator.page("str") Traceback (most recent call last): - InvalidPage: That page number is not an integer + PageNotAnInteger: That page number is not an integer """ def _ensure_int(self, num, e): # see Django #7307