__init __()只需1个参数(3个给定)Google应用引擎

时间:2014-09-30 18:01:34

标签: python google-app-engine google-cloud-messaging

我一直在上传我的应用引擎应用程序的新版本,在我上传请求后,我将其作为回复:

__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 = "testmail@hotmail.com" # (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 个答案:

答案 0 :(得分:1)

试试这个:

class HomeHandler(webapp2.RequestHandler):
    def __init__(self, request, response):
        self.initialize(request, response)
        ...