def GET(self, url): pages = [i.db2dict() for i in reader.get_all_pages()] post = reader.get_post_by_url(url) if post: template_values = { 'post': post.db2dict(), 'pages': pages, } web.header('Content-Type', 'text/javascript; charset=UTF-8') return json.dumps(template_values) else: raise web.notfound()
def GET(self, url): post = reader.get_post_by_url(url) if post: template_values = { 'post': post, 'site_info': self.site_info, 'pages': reader.get_all_pages() } path = os.path.join(os.path.dirname(__file__), 'tpl', 'post') return template_render('post.html', path, template_values) else: raise web.notfound()