Permalink
Browse files

configurable limits, no paging link on last page

  • Loading branch information...
1 parent 0f5db2b commit 1dfdd959a598bf1ecd7183ea43d779d731857a89 Benjamin Golub committed Aug 30, 2010
Showing with 8 additions and 4 deletions.
  1. +8 −4 blog.py
View
@@ -169,10 +169,12 @@ def get(self):
q.with_cursor(cursor)
except (db.BadRequestError, db.BadValueError):
cursor = None
- entries = q.fetch(limit=5)
+ limit = self.application.settings.get("num_home", 5)
+ entries = q.fetch(limit=limit)
if not cursor:
self.recent_entries = entries
- self.render("home.html", entries=entries, cursor=q.cursor())
+ cursor = q.cursor() if len(entries) == limit else None
+ self.render("home.html", entries=entries, cursor=cursor)
class AboutHandler(BaseHandler):
@@ -191,10 +193,12 @@ def get(self):
q.with_cursor(cursor)
except (db.BadRequestError, db.BadValueError):
cursor = None
- entries = q.fetch(limit=10)
+ limit = self.application.settings.get("num_archive", 10)
+ entries = q.fetch(limit=limit)
if not cursor:
self.recent_entries = entries[:5]
- self.render("archive.html", entries=entries, cursor=q.cursor())
+ cursor = q.cursor() if len(entries) == limit else None
+ self.render("archive.html", entries=entries, cursor=cursor)
class ComposeHandler(BaseHandler):

0 comments on commit 1dfdd95

Please sign in to comment.