Skip to content

Commit

Permalink
paginate queries on /developers
Browse files Browse the repository at this point in the history
  • Loading branch information
rolinh committed May 12, 2014
1 parent c2ec875 commit 34bebfb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion devmine/app/controllers/developers_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ class DevelopersController(ApplicationController):

def index(self, db):
"""Return the list of all developers."""
return json.dumps(db.query(Developer).all(), cls=ah.AlchemyEncoder)
since_id = super().get_since_id()
try:
developers = db.query(Developer).filter(Developer.id.between(
since_id, since_id + 100)).all()
except NoResultFound:
developers = {}
return json.dumps(developers, cls=ah.AlchemyEncoder)

def show(self, db, id):
"""Return the developer correspond to the given id."""
Expand Down

0 comments on commit 34bebfb

Please sign in to comment.