Add __len__ to PagedLists

pull/2216/head
Philipp Hagemeister 2014-01-22 21:43:33 +01:00
parent bd2d82a5d3
commit dd26ced164
1 changed files with 4 additions and 0 deletions

View File

@ -1172,6 +1172,10 @@ class PagedList(object):
self._pagefunc = pagefunc
self._pagesize = pagesize
def __len__(self):
# This is only useful for tests
return len(self.getslice())
def getslice(self, start=0, end=None):
res = []
for pagenum in itertools.count(start // self._pagesize):