From 22dd92278609d35740c8f4b545b994bd19b19533 Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Wed, 26 Jun 2013 05:38:40 +0200 Subject: [PATCH] Fixed formparams bug when defaults are missing. --- wrw/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wrw/util.py b/wrw/util.py index 759c295..aea3037 100644 --- a/wrw/util.py +++ b/wrw/util.py @@ -17,7 +17,7 @@ def formparams(callable): for arg in list(args): if arg not in spec.args: del args[arg] - for i in xrange(len(spec.args) - len(spec.defaults)): + for i in xrange(len(spec.args) - (len(spec.defaults) if spec.defaults else 0)): if spec.args[i] not in args: raise resp.httperror(400, "Missing parameter", ("The query parameter `", resp.h.code(spec.args[i]), "' is required but not supplied.")) return callable(**args) -- 2.11.0