2014-09-30 43 views
1

我已经上传我的App Engine应用程序的新版本,当我提出请求上传后,我得到这个作为响应:__init __()恰恰1个参数(3给出)谷歌应用程序引擎

__init__() takes exactly 1 argument (3 given) 
Traceback (most recent call last): 
    File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1511, in __call__ 
    rv = self.handle_exception(request, response, e) 
    File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1505, in __call__ 
    rv = self.router.dispatch(request, response) 
    File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher 
    return route.handler_adapter(request, response) 
    File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1076, in __call__ 
    handler = self.handler(request, response) 
TypeError: __init__() takes exactly 1 argument (3 given) 

我不知道该做什么,我评论了部分代码,取消了评论,我已经将代码上传到了我拥有的不同GAE应用程序,甚至是这些应用程序的多个版本。

我什至不知道从哪里开始任何人都可以告诉我这个错误甚至可能意味着什么?我会提供您提出的任何信息,请提前致谢。

编辑: 这是什么,我已经加入貌似处理​​程序:

class GCMRegister(webapp2.RequestHandler): 
    def post(self): 
     regid = self.request.get("regId") 
     if not regid: 
      self.response.out.write('Must specify regid') 
     else: 
      u = usuario() 
      u.name = "deadlybacon" # ax_length = 140) 
      u.mail = "[email protected]" # (max_length = 256, db_index = True 
      u.password = "password" #max_length = 140) 
      u.put() 
      u.push_key(regid) 

我WSGIApplication会是这样的:

application = webapp2.WSGIApplication([ 
    ('/', MainPage), 

    ('/indexData', indexData), 
    ('/ajaxLogIn', ajaxLogIn), 
    ('/createGroup', createGroup), 
    ('/masterServices', masterServices), 
    ('/groupInfo', groupInfo), 
    ('/groupInviteTo', groupInviteTo), 
    ('/acceptNotif', acceptNotif), 
    ('/adventureCreate', createAdventure), 
    ('/adventureAppointTo', adventureAppointTo), 
    ('/addNewPrueba', addNewPrueba), 
    ('/listPoolPruebas', listPoolPruebas), 
    ('/addExistingPrueba', addExistingPrueba), 

    ('/gcm/register', GCMRegister), 

]) #, debug=True, config = config) 

起初我以为这是调试和配置,这就是为什么我评论它,没有什么区别,不管发生什么,都会发生同样的错误

+1

你的处理程序是什么样的?我想你忘了将'request'和'response'参数添加到你的类'__init__'方法中。 – 2014-09-30 18:02:58

+0

我刚刚编辑的问题,它就是这样,它就像其他处理程序我只是困惑idk最新情况 – DeadlyBacon 2014-09-30 19:06:57

+0

处理程序如何注册? – 2014-09-30 19:07:53

回答

1

试试这个:

class HomeHandler(webapp2.RequestHandler): 
    def __init__(self, request, response): 
     self.initialize(request, response) 
     ... 
相关问题