Udacity Corrector CS253给我错误

时间:2013-12-15 07:26:32

标签: python http redirect

我正试图在Udacity(使用Python进行Web开发)中通过CS253的期末考试,但我收到了这个错误。

We received status code 200 in your HTTP Response when trying to post to the page      
http://donadevwiki.appspot.com/_edit/PVftJYpwWboj

After editing, we should be redirected to http://donadevwiki.appspot.com/PVftJYpwWboj      
indicated by status code 302.

我的webapp工作正常,我不知道我哪里错了.. 有人可以帮帮我吗?

Firstable,我有这个处理程序:

class EditPage(Handler):
    def get(self,name): 
        query = db.GqlQuery("SELECT * FROM WikiDB WHERE link=:1",name).get()
        content = ""
        if checkUser(self) is None:
            self.redirect("/login")
        if query is not None:
            content = query.content
        self.render("edit.html",content=content,username=checkUser(self),wiki=name) 

但是当我看到校正器错误(与此类似,但有一个http 405错误而不是200错误)时,我改为

 class EditPage(Handler):
    def get(self,name): 
        query = db.GqlQuery("SELECT * FROM WikiDB WHERE link=:1",name).get()
        content = ""
        if checkUser(self) is None:
            self.redirect("/login")
        if query is not None:
            content = query.content
        self.render("edit.html",content=content,username=checkUser(self),wiki=name) 
    def post(self,name): 
        query = db.GqlQuery("SELECT * FROM WikiDB WHERE link=:1",name).get()
        content = ""
        if checkUser(self) is None:
            self.redirect("/login")
        if query is not None:
            content = query.content
        self.render("edit.html",content=content,username=checkUser(self),wiki=name)

并且校正员给了我这个错误。我知道post和get方法都做同样的事情,但我只做post方法测试校正器: - )

 def checkUser(self):
    cookie = self.request.cookies.get('user_id')
    if cookie:
        val = check_secure_val(cookie)
        if val:
            dictio = db.GqlQuery("SELECT * FROM User").fetch(limit=32423)
            for user in dictio:
                if user.key().id()==int(val):
                    return user.name

0 个答案:

没有答案
相关问题