]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Add a function to parse arguments for the replace parameter
authorkevan <kevan@isnotajoke.com>
Mon, 20 Jul 2009 03:47:23 +0000 (20:47 -0700)
committerkevan <kevan@isnotajoke.com>
Mon, 20 Jul 2009 03:47:23 +0000 (20:47 -0700)
src/allmydata/web/common.py

index 28aec62c50e879abaaa93da1d510e577f78cc7cd..0de47717675d8260a92b3cca1d29f141289b0989 100644 (file)
@@ -21,6 +21,12 @@ def boolean_of_arg(arg):
     assert arg.lower() in ("true", "t", "1", "false", "f", "0", "on", "off")
     return arg.lower() in ("true", "t", "1", "on")
 
+def parse_replace_arg(replace):
+    if replace == "only-files":
+        return replace
+    else:
+        return boolean_of_arg(replace)
+
 def get_root(ctx_or_req):
     req = IRequest(ctx_or_req)
     # the addSlash=True gives us one extra (empty) segment