Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #14998 -- Made use of os.path.join to make sure this works on a…

…ll platforms. Thanks for the pointer, CarlFK.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15128 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit be56f74f93e97118dca32d83697803e3f9f42db0 1 parent e45d1e2
@jezdez jezdez authored
View
2  django/contrib/staticfiles/management/commands/collectstatic.py
@@ -100,7 +100,7 @@ def copy_file(self, source, prefix, source_storage, **options):
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
2  django/contrib/staticfiles/storage.py
@@ -82,6 +82,6 @@ def get_files(self, ignore_patterns=[]):
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
11 django/contrib/staticfiles/utils.py
@@ -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 is_ignored(path):
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
Please sign in to comment.
Something went wrong with that request. Please try again.