diff options
| author | Chris McDonough <chrism@plope.com> | 2011-09-11 21:55:40 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2011-09-11 21:55:40 -0400 |
| commit | ac15b5a6a4c9e71e299d427bd3cbe7a0426a4376 (patch) | |
| tree | 231453d5d079b0c736605ce84fa5fc28fb40749b | |
| parent | 2cf1d0efe6d281bc2a0d8316af8480765200eeea (diff) | |
| download | pyramid-ac15b5a6a4c9e71e299d427bd3cbe7a0426a4376.tar.gz pyramid-ac15b5a6a4c9e71e299d427bd3cbe7a0426a4376.tar.bz2 pyramid-ac15b5a6a4c9e71e299d427bd3cbe7a0426a4376.zip | |
garden
| -rw-r--r-- | pyramid/static.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/pyramid/static.py b/pyramid/static.py index 63c7dea73..eeb88bf5c 100644 --- a/pyramid/static.py +++ b/pyramid/static.py @@ -1,8 +1,16 @@ # -*- coding: utf-8 -*- -import os -from os.path import normcase, normpath, join, getmtime, getsize, isdir, exists -from pkg_resources import resource_exists, resource_filename, resource_isdir import mimetypes +import os +from os.path import normcase +from os.path import normpath +from os.path import join +from os.path import getmtime +from os.path import getsize +from os.path import isdir +from os.path import exists +from pkg_resources import resource_exists +from pkg_resources import resource_filename +from pkg_resources import resource_isdir from repoze.lru import lru_cache @@ -167,13 +175,14 @@ class static_view(object): url = url + '?' + qs return HTTPMovedPermanently(url) -_has_insecure_pathelement = set(['..', '.', '']).intersection _seps = set(['/', os.sep]) def _contains_slash(item): for sep in _seps: if sep in item: return True +_has_insecure_pathelement = set(['..', '.', '']).intersection + @lru_cache(1000) def _secure_path(path_tuple): if _has_insecure_pathelement(path_tuple): |
