我下载appengine-rest-server(1.0.6)并尝试在我的应用程序中使用此模块,但是我遇到了一些错误。有没有人使用python 2.7.2的工作示例?
按照我的代码初始化模块:
rest.Dispatcher.base_url = '/rest'
rest.Dispatcher.add_models({
"customer": customer.customer,
"place": customer.place})
application = webapp.WSGIApplication([<Some other Routs> ,
('/rest/.*', rest.Dispatcher)], debug=True)
我收到此错误:
File "\src\rest\__init__.py", line 1551, in initialize
request.disp_query_params_ = None
AttributeError: 'NoneType' object has no attribute 'disp_query_params_'
也许是我的错?
答案 0 :(得分:0)
修改以下功能,似乎有效。
def initialize(self, request, response):
if request != None and response != None:
super(Dispatcher, self).initialize(request, response)
request.disp_query_params_ = None
response.disp_cache_resp_ = True
response.disp_out_type_ = TEXT_CONTENT_TYPE