pagination: handle empty sets of data in sqlPaginator for backward compat.
This commit is contained in:
parent
97cbe3b81b
commit
869993afa8
1 changed files with 4 additions and 0 deletions
|
|
@ -911,6 +911,10 @@ class SqlalchemyOrmWrapper(object):
|
|||
return self.collection[range]
|
||||
|
||||
def __len__(self):
|
||||
# support empty types, without actually making a query.
|
||||
if self.collection is None or self.collection == []:
|
||||
return 0
|
||||
|
||||
# Count the number of objects in an sqlalchemy.orm.query.Query object
|
||||
return self.collection.count()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue