forked from ScoDoc/ScoDoc
try to convert args to integers
This commit is contained in:
parent
dfd4d5bb9d
commit
bcb7dc828d
@ -177,7 +177,14 @@ def scodoc7func(context):
|
||||
elif arg_name == "context":
|
||||
pos_arg_values.append(context)
|
||||
else:
|
||||
pos_arg_values.append(req_args[arg_name])
|
||||
v = req_args[arg_name]
|
||||
# try to convert all arguments to INTEGERS
|
||||
# necessary for db ids and boolean values
|
||||
try:
|
||||
v = int(v)
|
||||
except ValueError:
|
||||
pass
|
||||
pos_arg_values.append(v)
|
||||
# current_app.logger.info("pos_arg_values=%s" % pos_arg_values)
|
||||
# current_app.logger.info("req_args=%s" % req_args)
|
||||
# Add keyword arguments
|
||||
@ -187,7 +194,14 @@ def scodoc7func(context):
|
||||
kwargs[arg_name] = REQUEST
|
||||
elif arg_name in req_args:
|
||||
# set argument kw optionnel
|
||||
kwargs[arg_name] = req_args[arg_name]
|
||||
v = req_args[arg_name]
|
||||
# try to convert all arguments to INTEGERS
|
||||
# necessary for db ids and boolean values
|
||||
try:
|
||||
v = int(v)
|
||||
except ValueError:
|
||||
pass
|
||||
kwargs[arg_name] = v
|
||||
# current_app.logger.info(
|
||||
# "scodoc7func_decorator: top_level=%s, pos_arg_values=%s, kwargs=%s"
|
||||
# % (top_level, pos_arg_values, kwargs)
|
||||
|
Loading…
Reference in New Issue
Block a user