0

ここで説明されているように、RESTful サービスを実装しようとしています: http://www.web2pyslices.com/slice/show/1533/restful-api-with-web2py

GET、PUT、および POST は期待どおりに機能しますが、DELETE は機能しません。私は得る

 <type 'exceptions.TypeError'> not indexable

web2py™ Version 
 2.6.3-stable+timestamp.2013.09.15.17.01.20
Python  Python 2.7.4: /usr/bin/python (prefix: /usr)  
Traceback (most recent call last):  
  File "../gluon/restricted.py", line 217, in restricted  
    exec ccode in environment  
  File "../applications/app/controllers/default.py", line 103, in <module>  
  File "../gluon/globals.py", line 378, in <lambda>  
    self._caller = lambda f: f()  
  File "../gluon/globals.py", line 348, in f  
    raise e  
TypeError: not indexable

何か案は?

4

2 に答える 2

1

デバッグ後vars、例外をスローする解析関数が問題の原因であることがわかりました。globals.pyatに次のコードを追加しましたdef restful(self)

if rest_action.func_name == 'DELETE':
    return  rest_action(*_self.args)

これで問題は解決しました

于 2013-09-18T09:40:39.430 に答える