comparison piecrust/data/iterators.py @ 21:53b9df2263dc

Fix for pages listing pages from other sources.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 18 Aug 2014 23:20:03 -0700
parents 3a13b43e77c1
children e9dc18a275ff
comparison
equal deleted inserted replaced
20:c95c90c82263 21:53b9df2263dc
30 else: 30 else:
31 self.has_more = False 31 self.has_more = False
32 self._cache = inner_list[self.offset:] 32 self._cache = inner_list[self.offset:]
33 33
34 if self.current_page: 34 if self.current_page:
35 idx = inner_list.index(self.current_page) 35 try:
36 idx = inner_list.index(self.current_page)
37 except ValueError:
38 idx = -1
36 if idx >= 0: 39 if idx >= 0:
37 if idx < self.inner_count - 1: 40 if idx < self.inner_count - 1:
38 self.next_page = inner_list[idx + 1] 41 self.next_page = inner_list[idx + 1]
39 if idx > 0: 42 if idx > 0:
40 self.prev_page = inner_list[idx - 1] 43 self.prev_page = inner_list[idx - 1]