Added werkzeug's arguments

bzr revid: nicolas.vanhoren@openerp.com-20130620121026-btc06m36x9jg1ok0
This commit is contained in:
niv-openerp 2013-06-20 14:10:26 +02:00
parent 027f77a3ce
commit 4119d7ce99
2 changed files with 11 additions and 5 deletions

View File

@ -1115,7 +1115,7 @@ class DataSet(http.Controller):
return self._call_kw(model, method, args, {})
@http.route(['/web/dataset/call_kw', '/web/dataset/call_kw/<path:path>'], type='json', authentication="auth")
def call_kw(self, model, method, args, kwargs):
def call_kw(self, model, method, args, kwargs, path=None):
return self._call_kw(model, method, args, kwargs)
@http.route('/web/dataset/call_button', type='json', authentication="auth")

View File

@ -417,7 +417,7 @@ def jsonrequest(f):
base = f.__name__
if f.__name__ == "index":
base = ""
return route([base, os.path.join(base, "<path:path>")], type="json", authentication="auth")(f)
return route([base, os.path.join(base, "<path:_ignored_path>")], type="json", authentication="auth")(f)
class HttpRequest(WebRequest):
""" Regular GET/POST request
@ -500,7 +500,7 @@ def httprequest(f):
base = f.__name__
if f.__name__ == "index":
base = ""
return route([base, os.path.join(base, "<path:path>")], type="http", authentication="auth")(f)
return route([base, os.path.join(base, "<path:_ignored_path>")], type="http", authentication="auth")(f)
#----------------------------------------------------------
# Local storage of requests
@ -865,9 +865,15 @@ class Root(object):
"""
path = request.httprequest.path
urls = self.get_db_router(request.db).bind("")
func, original = urls.match(path)[0]
matched, arguments = urls.match(path)
arguments = dict([(k, v) for k, v in arguments.items() if not k.startswith("_ignored_")])
func, original = matched
request.func = func
def nfunc(*args, **kwargs):
kwargs.update(arguments)
return func(*args, **kwargs)
request.func = nfunc
request.auth_method = getattr(original, "auth", "auth")
request.func_request_type = original.exposed