diff options
author | Andy Doan <andy.doan@linaro.org> | 2015-06-08 10:20:13 -0500 |
---|---|---|
committer | Andy Doan <andy.doan@linaro.org> | 2015-06-11 13:43:34 -0500 |
commit | 958642fe2deacb34f05c92d34a846534a74fac2c (patch) | |
tree | ea64f67a91971c21e0ad02f3e05bd18ac24b156e | |
parent | 64357eca8910d59702e22a9d0b6564c4f51bbe69 (diff) |
test_path is too complex, break it up
This breaks the logic for finding the paths we serve into its own
function.
Change-Id: Iea5c10a9ee2fc8f3700b45a5f2eac5bd7d36d7fa
-rw-r--r-- | license_protected_downloads/common.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/license_protected_downloads/common.py b/license_protected_downloads/common.py index 4ee09eb..9c9aa47 100644 --- a/license_protected_downloads/common.py +++ b/license_protected_downloads/common.py @@ -149,9 +149,7 @@ def _handle_wildcard(request, fullpath): return match -def test_path(path, request): - """Check that path points to something we can serve up. - """ +def _find_served_paths(path, request): served_paths = settings.SERVED_PATHS # if key is in request.GET["key"] then need to mod path and give # access to a per-key directory. @@ -164,7 +162,13 @@ def test_path(path, request): # served_paths as needed. if not key_details[0].public: served_paths = [settings.UPLOAD_PATH] + return served_paths, path + +def test_path(path, request): + """Check that path points to something we can serve up. + """ + served_paths, path = _find_served_paths(path, request) for basepath in served_paths: fullpath = safe_path_join(basepath, path) if fullpath is None: |