diff options
-rw-r--r-- | mediagoblin/db/sql/base.py | 3 | ||||
-rw-r--r-- | mediagoblin/tools/pagination.py | 7 |
2 files changed, 5 insertions, 5 deletions
diff --git a/mediagoblin/db/sql/base.py b/mediagoblin/db/sql/base.py index 8aa9cc3a..fbbac6f9 100644 --- a/mediagoblin/db/sql/base.py +++ b/mediagoblin/db/sql/base.py @@ -35,9 +35,6 @@ class GMGQuery(Query): key_col = desc(key_col) return self.order_by(key_col) - def skip(self, amount): - return self.offset(amount) - Session = scoped_session(sessionmaker(query_cls=GMGQuery)) diff --git a/mediagoblin/tools/pagination.py b/mediagoblin/tools/pagination.py index 141d91cc..af889abd 100644 --- a/mediagoblin/tools/pagination.py +++ b/mediagoblin/tools/pagination.py @@ -63,8 +63,11 @@ class Pagination(object): """ Returns slice of objects for the requested page """ - return self.cursor.skip( - (self.page - 1) * self.per_page).limit(self.per_page) + # TODO, return None for out of index so templates can + # distinguish between empty galleries and out-of-bound pages??? + return self.cursor.slice( + (self.page - 1) * self.per_page, + self.page * self.per_page) @property def pages(self): |