]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blobdiff - src/allmydata/web/common.py
Change web-API to support t=relink instead of t=move (+ docs and tests). fixes #1732
[tahoe-lafs/tahoe-lafs.git] / src / allmydata / web / common.py
index 13385c5f66bcb5743a45f7aa37dabc0c096872a1..c3b94d2a36957c238a1355a5332096231f968e8e 100644 (file)
@@ -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"):