Я пытаюсь настроить службу protorpc с помощью google app engine python 2.7, и, насколько я помню, это работало нормально, пока внезапно не перестало работать, и теперь я не могу понять, что происходит не так.
Ошибка:
__call__() takes exactly 1 argument (3 given)
Traceback (most recent call last):
File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1040, in __call__
return self.handler(request, *args, **kwargs)
TypeError: __call__() takes exactly 1 argument (3 given)
Traceback (most recent call last):
File "/base/data/home/apps/s~smokin-goldshop/15.356936819989737198/handler/orderajax.py", line 78, in main
util.run_wsgi_app(application)
File "/base/python27_runtime/python27_lib/versions/1/google/appengine/ext/webapp/util.py", line 98, in run_wsgi_app
run_bare_wsgi_app(add_wsgi_middleware(application))
File "/base/python27_runtime/python27_lib/versions/1/google/appengine/ext/webapp/util.py", line 116, in run_bare_wsgi_app
result = application(env, _start_response)
File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1519, in __call__
response = self._internal_error(e)
File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1040, in __call__
return self.handler(request, *args, **kwargs)
TypeError: __call__() takes exactly 1 argument (3 given)
Код вопроса:
import logging
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from protorpc import messages
from protorpc import remote
from protorpc import service_handlers
from protorpc.service_handlers import ServiceHandlerFactory
from customerhandler import CustomerHandler
from models.customer import Customer
class BlacklistRequest(messages.Message):
BlackListType = messages.StringField(1, required = True)
Customer = messages.StringField(2, required = True)
class BlacklistResponse(messages.Message):
Response = messages.StringField(1, required = True)
class BlacklistAjax(remote.Service):
@remote.method(BlacklistRequest, BlacklistResponse)
def ajax(self, request):
logging.debug("starting")
tRequest = request
logging.debug(str(tRequest))
tArgumentDic = {}
tCustomerHandler = CustomerHandler()
tCustomer = Customer()
logging.debug("Beginning Blacklist of type " + tRequest.BlackListType + " for customer " + tRequest.Customer)
if(tRequest.BlackListType == 'PA'):
tCustomerHandler.PaBlacklistCustomer(tRequest.Customer)
logging.debug("Blacklisted PA")
return BlacklistResponse(Response = "PA Blacklisted!")
elif(tRequest.BlackListType == 'Global'):
tCustomerHandler.GlobalBlacklistCustomer(tRequest.Customer)
logging.debug("Blacklisted Global")
return BlacklistResponse(Response = "Global Blacklisted!")
else:
logging.debug("Error Blacklisting")
return BlacklistResponse(Response = "Error Blacklisting")
service_mappings = service_handlers.service_mapping(
[('/orderajax', OrderAjax),
('/blacklist', BlacklistAjax)
])
application = webapp.WSGIApplication(service_mappings, debug=True)
def main():
util.run_wsgi_app(application)
if __name__ == '__main__':
main()