This commit is contained in:
Kload 2013-06-30 12:11:30 +00:00
parent b0dd6a2b2a
commit cdfae10d40

View file

@ -73,8 +73,12 @@ def http_exec(request):
for key, value in request.args.items(): for key, value in request.args.items():
if key in args: if key in args:
# Validate args # Validate args
if 'pattern' in args[key]: validate(args[key]['pattern'], value) if 'pattern' in args[key]:
if 'nargs' not in args[key] or ('nargs' != '*' and 'nargs' != '+'): value = value[0] validate(args[key]['pattern'], value)
if 'nargs' not in args[key] or ('nargs' != '*' and 'nargs' != '+'):
value = value[0]
if 'choices' in args[key] and value not in args[key]['choices']:
raise YunoHostError(22, _('Invalid argument') + ' ' + value)
if 'action' in args[key] and args[key]['action'] == 'store_true': if 'action' in args[key] and args[key]['action'] == 'store_true':
yes = ['true', 'True', 'yes', 'Yes'] yes = ['true', 'True', 'yes', 'Yes']
value = value in yes value = value in yes