예제 #1
0
 def GET(self):
     template_values = {
             'posts': reader.get_all_posts(),
             'pages': reader.get_all_pages(),
             'site_info': self.site_info
             }
     path = os.path.join(os.path.dirname(__file__), 'tpl', 'post')
     return template_render('posts.html', path, template_values)
예제 #2
0
 def GET(self):
     posts = [i.db2dict() for i in reader.get_latest()]
     pages = [i.db2dict() for i in reader.get_all_pages()]
     template_values = {
             'posts': posts,
             'pages': pages,
             }
     web.header('Content-Type', 'text/javascript; charset=UTF-8')
     return json.dumps(template_values)
예제 #3
0
 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()
예제 #4
0
 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()