Mercurial > piecrust2
diff piecrust/data/paginator.py @ 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 | dcdec4b951a1 |
children | 45ad976712ec |
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):