diff options
author | ianb <devnull@localhost> | 2008-11-16 00:33:22 +0000 |
---|---|---|
committer | ianb <devnull@localhost> | 2008-11-16 00:33:22 +0000 |
commit | 2747956188bc28956c0db5701f5f0ea0019b50bf (patch) | |
tree | c2d81f5d6aa34af6345f4795a120fc03db1e3e75 /paste/urlparser.py | |
parent | 3390876a00f7143ae77f4b941a13ef5b7235a817 (diff) | |
download | paste-2747956188bc28956c0db5701f5f0ea0019b50bf.tar.gz |
update test for new website content
Diffstat (limited to 'paste/urlparser.py')
-rw-r--r-- | paste/urlparser.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/paste/urlparser.py b/paste/urlparser.py index 8712639..519ddcf 100644 --- a/paste/urlparser.py +++ b/paste/urlparser.py @@ -430,20 +430,22 @@ class StaticURLParser(object): def __init__(self, directory, root_directory=None, cache_max_age=None): - if os.path.sep != '/': - directory = directory.replace(os.path.sep, '/') - self.directory = os.path.normcase(os.path.abspath(directory)) + self.directory = self.normpath(directory) self.root_directory = root_directory if root_directory is not None: - self.root_directory = os.path.normpath(self.root_directory) + self.root_directory = self.normpath(self.root_directory) else: - self.root_directory = directory - self.root_directory = os.path.normcase(os.path.normpath( - os.path.abspath(self.root_directory))) + self.root_directory = self.directory self.cache_max_age = cache_max_age - if os.path.sep != '/': - directory = directory.replace('/', os.path.sep) - self.root_directory = self.root_directory.replace('/', os.path.sep) + + def normpath(path): + path = os.path.normcase( + os.path.normpath( + os.path.abspath(path))) + if os.path.sep != '/': + path = path.replace(os.path.sep, '/') + return path + normpath = staticmethod(normpath) def __call__(self, environ, start_response): path_info = environ.get('PATH_INFO', '') |