Skip to content

Commit 706982b

Browse files
authored
Merge pull request pallets-eco#804 from CoburnJoe/patch-1
Removed conditional count from pagination
2 parents db02fd4 + 0a085e2 commit 706982b

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

flask_sqlalchemy/__init__.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -499,13 +499,8 @@ def paginate(self, page=None, per_page=None, error_out=True, max_per_page=None,
499499
if not items and page != 1 and error_out:
500500
abort(404)
501501

502-
# No need to count if we're on the first page and there are fewer
503-
# items than we expected or if count is disabled.
504-
505502
if not count:
506503
total = None
507-
elif page == 1 and len(items) < per_page:
508-
total = len(items)
509504
else:
510505
total = self.order_by(None).count()
511506

0 commit comments

Comments
 (0)