class HistoryPage(BlogHandler):
def get(self, path):
q = Page.by_path(path)
q.fetch(limit = 100)
posts = list(q)
if posts:
self.render("history.html" , path = path, posts = posts)
else:
self.redirect("/_edit" + path)
答案 0 :(得分:0)
您有缩进错误。行posts = list(q)
及其后的行应该进入get
方法:
class HistoryPage(BlogHandler):
def get(self, path):
q = Page.by_path(path)
q.fetch(limit = 100)
posts = list(q)
if posts:
self.render("history.html" , path = path, posts = posts)
else:
self.redirect("/_edit" + path)