Permalink
Browse files

use the settings

  • Loading branch information...
bgolub committed Feb 8, 2013
1 parent a68517b commit 495ca5bf82f35babab46ac1521427ee6b7ae6a6f
Showing with 3 additions and 2 deletions.
  1. +3 −2 blog.py
View
@@ -384,13 +384,14 @@ def render(self, entry, show_date=False):
class RecentEntriesModule(tornado.web.UIModule):
def render(self):
- cache_key = 'home_entries:%s:%s' % (None, 5)
+ limit = self.handler.application.settings.get("num_home", 5)
+ cache_key = 'home_entries:%s:%s' % (None, limit)
cached_data = memcache.get(cache_key)
if cached_data:
(entries, new_cursor) = cached_data
else:
q = db.Query(Entry).filter("hidden =", False).order("-published")
- entries = q.fetch(limit=5)
+ entries = q.fetch(limit=limit)
return self.render_string("modules/recententries.html", entries=entries)

0 comments on commit 495ca5b

Please sign in to comment.