def get(self): template = template_env.get_template("index.html") category = self.request.get("category") # check if we have a cached result cache_key = 'ventures_category_%s' % category template_vars = memcache.get(cache_key) # return result from cache if found if template_vars is not None: self.response.out.write(template.render(template_vars)) return # cache miss so get from datastore logging.info('CACHE MISS: %s' % cache_key) ventures = Venture.get_many("category", category) coords = get_coords(ventures) template_vars = {"coords": coords} # add template_vars to cache so subsequent checks are quicker memcache.set(cache_key, template_vars) self.response.out.write(template.render(template_vars))
def get(self): ventures = Venture.get_many("approved", False) template_vars = {"ventures": ventures} template = template_env.get_template("approvals.html") self.response.out.write(template.render(template_vars))