From: kevan Date: Mon, 20 Jul 2009 03:47:23 +0000 (-0700) Subject: Add a function to parse arguments for the replace parameter X-Git-Tag: allmydata-tahoe-1.5.0~32 X-Git-Url: https://git.rkrishnan.org/tahoe_css?a=commitdiff_plain;h=7ab92c751173a78e08aa436203349c108db8a953;p=tahoe-lafs%2Ftahoe-lafs.git Add a function to parse arguments for the replace parameter --- diff --git a/src/allmydata/web/common.py b/src/allmydata/web/common.py index 28aec62c..0de47717 100644 --- a/src/allmydata/web/common.py +++ b/src/allmydata/web/common.py @@ -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