From ac15b5a6a4c9e71e299d427bd3cbe7a0426a4376 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 11 Sep 2011 21:55:40 -0400 Subject: garden --- pyramid/static.py | 17 +++++++++++++---- 1 file 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): -- cgit v1.2.3