Skip to content

Instantly share code, notes, and snippets.

@darcyliu
Created April 14, 2011 04:15
Show Gist options
  • Save darcyliu/918878 to your computer and use it in GitHub Desktop.
Save darcyliu/918878 to your computer and use it in GitHub Desktop.
class HomeHandler(BaseRequestHandler):
def get(self):
nodes = memcache.get('nodes')
if nodes is None:
nodes = Node.all()
nodes.fetch(100)
nodes = self.snippet('nodes.html',{'nodes':nodes})
memcache.set('nodes', nodes, 1800)
topics = memcache.get('topics')
if topics is None:
topics = Topic.all()
topics.filter('ref =', None )
topics.order('-updated')
topics.fetch(100)
topics = self.snippet('topics.html',{'topics':topics})
memcache.set('topics', topics, 1800)
values = {'nodes':nodes,'topics':topics}
self.render('home.html',values)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment