summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-09-08 03:04:01 -0400
committerChris McDonough <chrism@plope.com>2011-09-08 03:04:01 -0400
commit0ab0b9ef8a970584e5ef3fdf7d6943e456b95380 (patch)
tree34a5bfb5595d9bfab07c0379162930e0795603f9
parentc55903c70838167ee7f152c135e98724dc647063 (diff)
downloadpyramid-0ab0b9ef8a970584e5ef3fdf7d6943e456b95380.tar.gz
pyramid-0ab0b9ef8a970584e5ef3fdf7d6943e456b95380.tar.bz2
pyramid-0ab0b9ef8a970584e5ef3fdf7d6943e456b95380.zip
python set intersection doesnt special case strings, so using 'in' is a loop is many times faster
-rw-r--r--pyramid/static.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/pyramid/static.py b/pyramid/static.py
index d3075fec0..72a76a014 100644
--- a/pyramid/static.py
+++ b/pyramid/static.py
@@ -168,7 +168,11 @@ class static_view(object):
return HTTPMovedPermanently(url)
has_insecure_pathelement = set(['..', '.', '']).intersection
-contains_slash = set(['/', os.sep]).intersection
+seps = set(['/', os.sep])
+def contains_slash(item):
+ for sep in seps:
+ if sep in item:
+ return True
@lru_cache(1000)
def _secure_path(path_tuple):