X-Git-Url: https://git.rkrishnan.org/?a=blobdiff_plain;f=src%2Fallmydata%2Fweb%2Fcommon.py;h=c3b94d2a36957c238a1355a5332096231f968e8e;hb=35f37cc5b86465407a0eb85a7760f8442f5a969f;hp=13385c5f66bcb5743a45f7aa37dabc0c096872a1;hpb=ee9e8014773818e9b9ae6ebb606c757c060212d8;p=tahoe-lafs%2Ftahoe-lafs.git diff --git a/src/allmydata/web/common.py b/src/allmydata/web/common.py index 13385c5f..c3b94d2a 100644 --- a/src/allmydata/web/common.py +++ b/src/allmydata/web/common.py @@ -24,14 +24,17 @@ def getxmlfile(name): def boolean_of_arg(arg): # TODO: "" - assert arg.lower() in ("true", "t", "1", "false", "f", "0", "on", "off") + if arg.lower() not in ("true", "t", "1", "false", "f", "0", "on", "off"): + raise WebError("invalid boolean argument: %r" % (arg,), http.BAD_REQUEST) return arg.lower() in ("true", "t", "1", "on") def parse_replace_arg(replace): if replace.lower() == "only-files": return replace - else: + try: return boolean_of_arg(replace) + except WebError: + raise WebError("invalid replace= argument: %r" % (replace,), http.BAD_REQUEST) def get_format(req, default="CHK"):