Mercurial > piecrust2
changeset 976:b9374b3682f0
pagination: Prevent a possible crash when paginating things without a current page.
This is mostly for unit testing.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 17 Oct 2017 01:09:55 -0700 |
parents | a0a62d0da723 |
children | 84fc72a17f7a |
files | piecrust/data/paginator.py |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/piecrust/data/paginator.py Tue Oct 17 01:08:56 2017 -0700 +++ b/piecrust/data/paginator.py Tue Oct 17 01:09:55 2017 -0700 @@ -86,9 +86,10 @@ if self._items_per_page > 0: return self._items_per_page - ipp = self._page.config.get('items_per_page') - if ipp is not None: - return ipp + if self._page is not None: + ipp = self._page.config.get('items_per_page') + if ipp is not None: + return ipp from piecrust.sources.base import ContentSource if isinstance(self._source, ContentSource):