mirror of
https://github.com/pypiserver/pypiserver
synced 2025-02-22 19:19:37 +01:00
allow multiple roots in paste_app_factory
This commit is contained in:
parent
ff6fcdce18
commit
6c8d1b55b7
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user