Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Jannis Leidel authored January 02, 2011
2  django/contrib/staticfiles/management/commands/collectstatic.py
@@ -100,7 +100,7 @@ def copy_file(self, source, prefix, source_storage, **options):
100 100
         except (OSError, NotImplementedError):
101 101
             source_last_modified = None
102 102
         if prefix:
103  
-            destination = '/'.join([prefix, source])
  103
+            destination = os.path.join(prefix, source)
104 104
         else:
105 105
             destination = source
106 106
         symlink = options['link']
2  django/contrib/staticfiles/storage.py
@@ -82,6 +82,6 @@ def get_files(self, ignore_patterns=[]):
82 82
         prefix = self.get_prefix()
83 83
         for path in utils.get_files(self, ignore_patterns):
84 84
             if prefix:
85  
-                path = '/'.join([prefix, path])
  85
+                path = os.path.join(prefix, path)
86 86
             files.append(path)
87 87
         return files
11  django/contrib/staticfiles/utils.py
... ...
@@ -1,18 +1,17 @@
  1
+import os
1 2
 import fnmatch
2 3
 from django.conf import settings
3 4
 from django.core.exceptions import ImproperlyConfigured
4 5
 
5 6
 def get_files(storage, ignore_patterns=[], location=''):
6 7
     """
7  
-    Recursively walk the storage directories gathering a complete list of files
8  
-    that should be copied, returning this list.
9  
-    
  8
+    Recursively walk the storage directories gathering a complete
  9
+    list of files that should be copied, returning this list.
10 10
     """
11 11
     def is_ignored(path):
12 12
         """
13 13
         Return True or False depending on whether the ``path`` should be
14 14
         ignored (if it matches any pattern in ``ignore_patterns``).
15  
-        
16 15
         """
17 16
         for pattern in ignore_patterns:
18 17
             if fnmatch.fnmatchcase(path, pattern):
@@ -20,14 +19,14 @@ def is_ignored(path):
20 19
         return False
21 20
 
22 21
     directories, files = storage.listdir(location)
23  
-    static_files = [location and '/'.join([location, fn]) or fn
  22
+    static_files = [location and os.path.join(location, fn) or fn
24 23
                     for fn in files
25 24
                     if not is_ignored(fn)]
26 25
     for dir in directories:
27 26
         if is_ignored(dir):
28 27
             continue
29 28
         if location:
30  
-            dir = '/'.join([location, dir])
  29
+            dir = os.path.join(location, dir)
31 30
         static_files.extend(get_files(storage, ignore_patterns, dir))
32 31
     return static_files
33 32
 

0 notes on commit be56f74

Please sign in to comment.
Something went wrong with that request. Please try again.