Skip to content
Snippets Groups Projects
Commit a18d473c authored by Pavel Kácha's avatar Pavel Kácha
Browse files

Bugfix: arguments checking haven't survived json_wrapper decorator

parent 9f1f3e2c
No related branches found
No related tags found
No related merge requests found
......@@ -829,6 +829,8 @@ def expose(read=1, write=0, debug=0):
meth.read = read
meth.write = write
meth.debug = debug
if not hasattr(meth, "arguments"):
meth.arguments = meth.func_code.co_varnames[:meth.func_code.co_argcount]
return meth
return expose_deco
......@@ -846,7 +848,7 @@ class Server(ObjectBase):
return "%s(req=%s, auth=%s, handler=%s)" % (type(self).__name__, type(self.req).__name__, type(self.auth).__name__, type(self.handler).__name__)
def sanitize_args(self, path, func, args, exclude=["self"]):
def sanitize_args(self, path, func, args, exclude=["self", "post"]):
# silently remove internal args, these should never be used
# but if somebody does, we do not expose them by error message
intargs = set(args).intersection(exclude)
......@@ -857,7 +859,7 @@ class Server(ObjectBase):
# silently remove surplus arguments - potential forward
# compatibility (unknown args will get ignored)
badargs = set(args) - set(func.func_code.co_varnames[0:func.func_code.co_argcount])
badargs = set(args) - set(func.arguments)
for a in badargs:
del args[a]
if badargs:
......@@ -953,6 +955,10 @@ def json_wrapper(method):
return [('Content-type', 'application/json')], output
try:
meth_deco.arguments = method.arguments
except AttributeError:
meth_deco.arguments = method.func_code.co_varnames[:method.func_code.co_argcount]
return meth_deco
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment