Fixed #14998 -- Made use of os.path.join to make sure this works on all platforms. Thanks for the pointer, CarlFK.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15128 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jannis Leidel 2011-01-02 01:32:17 +00:00
parent e45d1e2dac
commit be56f74f93
3 changed files with 7 additions and 8 deletions

View File

@ -100,7 +100,7 @@ Type 'yes' to continue, or 'no' to cancel: """)
except (OSError, NotImplementedError):
source_last_modified = None
if prefix:
destination = '/'.join([prefix, source])
destination = os.path.join(prefix, source)
else:
destination = source
symlink = options['link']

View File

@ -82,6 +82,6 @@ class AppStaticStorage(FileSystemStorage):
prefix = self.get_prefix()
for path in utils.get_files(self, ignore_patterns):
if prefix:
path = '/'.join([prefix, path])
path = os.path.join(prefix, path)
files.append(path)
return files

View File

@ -1,18 +1,17 @@
import os
import fnmatch
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
def get_files(storage, ignore_patterns=[], location=''):
"""
Recursively walk the storage directories gathering a complete list of files
that should be copied, returning this list.
Recursively walk the storage directories gathering a complete
list of files that should be copied, returning this list.
"""
def is_ignored(path):
"""
Return True or False depending on whether the ``path`` should be
ignored (if it matches any pattern in ``ignore_patterns``).
"""
for pattern in ignore_patterns:
if fnmatch.fnmatchcase(path, pattern):
@ -20,14 +19,14 @@ def get_files(storage, ignore_patterns=[], location=''):
return False
directories, files = storage.listdir(location)
static_files = [location and '/'.join([location, fn]) or fn
static_files = [location and os.path.join(location, fn) or fn
for fn in files
if not is_ignored(fn)]
for dir in directories:
if is_ignored(dir):
continue
if location:
dir = '/'.join([location, dir])
dir = os.path.join(location, dir)
static_files.extend(get_files(storage, ignore_patterns, dir))
return static_files