def get(self, template_variables={}): p = int(self.get_argument("p", "1")) items = self.post_model.get_all_posts(current_page=p) for item in items["list"]: self.jinja2 = self.settings.get("jinja2") item["thumb"] = helper.Filters(self.jinja2).list_content_process( item["thumb"]) item["created"] = helper.Filters(self.jinja2).pretty_date( item["created"]) result_json = json.dumps(items, cls=DateEncoder) self.write(result_json)
def __init__(self, *argc, **argkw): super(BaseHandler, self).__init__(*argc, **argkw) self.session = lib.session.Session(self.application.session_manager, self) self.jinja2 = self.settings.get("jinja2") self.jinja2 = helper.Filters(self.jinja2).register()