From 6c8d1b55b7c60385f37b10149aba14b81f8b22d2 Mon Sep 17 00:00:00 2001 From: Ralf Schmitt Date: Mon, 28 Jan 2013 00:31:58 +0100 Subject: [PATCH] allow multiple roots in paste_app_factory --- pypiserver/__init__.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/pypiserver/__init__.py b/pypiserver/__init__.py index 7338099..bf12338 100644 --- a/pypiserver/__init__.py +++ b/pypiserver/__init__.py @@ -30,10 +30,20 @@ def app(root=None, def paste_app_factory(global_config, **local_conf): import os + + def _make_root(root): + root = root.strip() + if root.startswith("~"): + return os.path.expanduser(root) + return root + root = local_conf.get("root") - if root and root.startswith("~"): - root = os.path.expanduser(root) + if root: + roots = [_make_root(x) for x in root.split("\n") if x.strip()] + else: + roots = None + redirect_to_fallback = local_conf.get("redirect_to_fallback", "").lower() in ("yes", "on", "1") fallback_url = local_conf.get("fallback_url") password_file = local_conf.get("password_file") - return app(root=root, redirect_to_fallback=redirect_to_fallback, fallback_url=fallback_url, password_file=password_file) + return app(root=roots, redirect_to_fallback=redirect_to_fallback, fallback_url=fallback_url, password_file=password_file)