1

我下载了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_'

也许是我的错?

4

1 回答 1

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
于 2012-07-31T10:02:49.310 回答