Ok just I tried this @request.restful() def page(): def PATCH(*args, **vars): if args[0]: print 'PATCH args: ', args
But I still get a 400 "Bad Request" error (it does not say 400 "invalid arguments") that why I think it does not even come to this point. Also request.args() should work since I can use def PUT(*args, **vars): if request.args(0): print request.args(0) without a problem. The real problem must be that rest_action or some function much earlier (maybe even in the underlying werbserver) does not accept PATCH requests On Tuesday, August 12, 2014 7:18:14 PM UTC+2, Leonel Câmara wrote: > > request is available but the restful wrapper cleans request.args and calls > the function with them as args, you should not use request.args because > request.args have stuff that isn't exactly an argument, namely the method > 'PATCH' which is what would be in request.args(0). > > > > As you may have read I am getting a 400 error not a 500, that means > there is no error stack trace. > > That's not exactly true, the thing is, you want the rest API to inform the > caller if it's calling it wrong, and that's what web2py thinks it's > happening. > > Rest actions are run this way: > > try: > return rest_action(*_self.args, **getattr(_self, > 'vars', {})) > except TypeError, e: > exc_type, exc_value, exc_traceback = sys.exc_info() > if len(traceback.extract_tb(exc_traceback)) == 1: > raise HTTP(400, "invalid arguments") > > There you can see where the HTTP 400 comes from. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.