From 7ab92c751173a78e08aa436203349c108db8a953 Mon Sep 17 00:00:00 2001 From: kevan Date: Sun, 19 Jul 2009 20:47:23 -0700 Subject: [PATCH] Add a function to parse arguments for the replace parameter --- src/allmydata/web/common.py | 6 ++++++ 1 file changed, 6 insertions(+) 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 -- 2.45.2