def get(self): whereclause = ' AND '.join(['%s = FALSE' % m.lower() for m in allmonths()]) logging.debug(whereclause) q = Recipe.gql('WHERE ' + whereclause) templatevalues = RequestContext(self.request, { 'recipes' : [r for r in q] }) path = os.path.join(os.path.dirname(__file__), 'no_season.html') self.response.out.write(template.render(path, templatevalues))
def get(self, month): if month.capitalize() in seasons().keys(): recipes = uniq([k for k in queryForMonth(seasons()[month][0])] + [k for k in queryForMonth(seasons()[month][1])] + [k for k in queryForMonth(seasons()[month][2])]) recipes = [Recipe.get(k) for k in recipes] else: recipes = [r for r in Recipe.gql('WHERE %s = TRUE' % month.lower())] templatevalues = RequestContext(self.request, { 'month' : month.capitalize(), 'recipes' : recipes, 'json' : simplejson.dumps([r.to_dict() for r in recipes]), }) path = os.path.join(os.path.dirname(__file__), 'month.html') self.response.out.write(template.render(path, templatevalues))