# HG changeset patch # User Daniele Nicolodi # Date 1313431559 -7200 # Node ID 90c1fa07f6a7c25c623abbc0dc41177091bc1a2c # Parent 543f68b3a8f08417f612385430cc4e913db3a247 Small tweaks to pagination API. Extend unit tests. diff -r 543f68b3a8f0 -r 90c1fa07f6a7 src/ltpdarepo/pagination.py --- a/src/ltpdarepo/pagination.py Mon Aug 15 20:05:13 2011 +0200 +++ b/src/ltpdarepo/pagination.py Mon Aug 15 20:05:59 2011 +0200 @@ -8,10 +8,6 @@ self.items = items @property - def page(self): - return self.current - - @property def pages(self): return int(ceil(self.count / float(self.size))) @@ -24,9 +20,9 @@ return self.current < self.pages @property - def slice(self): + def limits(self): start = (self.current - 1) * self.size - return slice(start, start + self.size) + return start, self.size def __iter__(self): # cache number of pages diff -r 543f68b3a8f0 -r 90c1fa07f6a7 src/ltpdarepo/templates/pagination.html --- a/src/ltpdarepo/templates/pagination.html Mon Aug 15 20:05:13 2011 +0200 +++ b/src/ltpdarepo/templates/pagination.html Mon Aug 15 20:05:59 2011 +0200 @@ -1,12 +1,12 @@ {% macro render(pagination) %}