-1
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)
4

1 回答 1

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)
于 2013-09-03T12:35:33.443 回答