1
0
mirror of https://github.com/golang/go synced 2024-11-22 11:54:50 -07:00

dashboard: fix project tag filter

R=rsc
CC=golang-dev
https://golang.org/cl/3439043
This commit is contained in:
Andrew Gerrand 2010-12-10 08:29:34 +11:00
parent e3b6188ca2
commit 8984fa8fce

View File

@ -242,7 +242,11 @@ class ProjectPage(webapp.RequestHandler):
self.list({"submitMsg": "Your project has been submitted."}) self.list({"submitMsg": "Your project has been submitted."})
def list(self, additional_data={}): def list(self, additional_data={}):
data = memcache.get('view-project-data') cache_key = 'view-project-data'
tag = self.request.get('tag', None)
if tag:
cache_key += '-'+tag
data = memcache.get(cache_key)
admin = users.is_current_user_admin() admin = users.is_current_user_admin()
if admin or not data: if admin or not data:
projects = Project.all().order('category').order('name') projects = Project.all().order('category').order('name')
@ -255,7 +259,6 @@ class ProjectPage(webapp.RequestHandler):
for t in p.tags: for t in p.tags:
tags.add(t) tags.add(t)
tag = self.request.get('tag', None)
if tag: if tag:
projects = filter(lambda x: tag in x.tags, projects) projects = filter(lambda x: tag in x.tags, projects)
@ -265,7 +268,7 @@ class ProjectPage(webapp.RequestHandler):
data['projects'] = projects data['projects'] = projects
data['admin']= admin data['admin']= admin
if not admin: if not admin:
memcache.set('view-project-data', data, time=CacheTimeout) memcache.set(cache_key, data, time=CacheTimeout)
for k, v in additional_data.items(): for k, v in additional_data.items():
data[k] = v data[k] = v