Created
April 14, 2011 04:15
-
-
Save darcyliu/918878 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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