Remove Mongoism query.skip()
sqlalchemy supports slice() or [n:m] just fine. Right now, it seems we cannot distinguish beween "empty" results and out-of bound slices. It would be nice if we could distinguish these somehow. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
parent
af008743ca
commit
10f1f2f56b
@ -35,9 +35,6 @@ class GMGQuery(Query):
|
|||||||
key_col = desc(key_col)
|
key_col = desc(key_col)
|
||||||
return self.order_by(key_col)
|
return self.order_by(key_col)
|
||||||
|
|
||||||
def skip(self, amount):
|
|
||||||
return self.offset(amount)
|
|
||||||
|
|
||||||
|
|
||||||
Session = scoped_session(sessionmaker(query_cls=GMGQuery))
|
Session = scoped_session(sessionmaker(query_cls=GMGQuery))
|
||||||
|
|
||||||
|
@ -63,8 +63,11 @@ class Pagination(object):
|
|||||||
"""
|
"""
|
||||||
Returns slice of objects for the requested page
|
Returns slice of objects for the requested page
|
||||||
"""
|
"""
|
||||||
return self.cursor.skip(
|
# TODO, return None for out of index so templates can
|
||||||
(self.page - 1) * self.per_page).limit(self.per_page)
|
# 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
|
@property
|
||||||
def pages(self):
|
def pages(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user