Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #16424 -- Fixed regression in collect static management command…

… introduced in r16509 that prevented prefixed collection.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16519 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 21e0b3a243791deef803dddcb9e15d0a3b59af96 1 parent 901ea8a
Jannis Leidel authored July 06, 2011
6  django/contrib/staticfiles/management/commands/collectstatic.py
@@ -107,8 +107,10 @@ def handle_noargs(self, **options):
107 107
             for path, storage in finder.list(self.ignore_patterns):
108 108
                 # Prefix the relative path if the source storage contains it
109 109
                 if getattr(storage, 'prefix', None):
110  
-                    path = os.path.join(storage.prefix, path)
111  
-                handler(path, path, storage)
  110
+                    prefixed_path = os.path.join(storage.prefix, path)
  111
+                else:
  112
+                    prefixed_path = path
  113
+                handler(path, prefixed_path, storage)
112 114
 
113 115
         actual_count = len(self.copied_files) + len(self.symlinked_files)
114 116
         unmodified_count = len(self.unmodified_files)
1  tests/regressiontests/staticfiles_tests/project/prefixed/test.txt
... ...
@@ -0,0 +1 @@
  1
+Prefix!
6  tests/regressiontests/staticfiles_tests/tests.py
@@ -54,7 +54,10 @@ def assertFileNotFound(self, filepath):
54 54
     STATIC_URL = '/static/',
55 55
     MEDIA_ROOT =  os.path.join(TEST_ROOT, 'project', 'site_media', 'media'),
56 56
     STATIC_ROOT = os.path.join(TEST_ROOT, 'project', 'site_media', 'static'),
57  
-    STATICFILES_DIRS = (os.path.join(TEST_ROOT, 'project', 'documents'),),
  57
+    STATICFILES_DIRS = (
  58
+        os.path.join(TEST_ROOT, 'project', 'documents'),
  59
+        ('prefix', os.path.join(TEST_ROOT, 'project', 'prefixed')),
  60
+    ),
58 61
     STATICFILES_FINDERS = (
59 62
         'django.contrib.staticfiles.finders.FileSystemFinder',
60 63
         'django.contrib.staticfiles.finders.AppDirectoriesFinder',
@@ -105,6 +108,7 @@ def test_staticfiles_dirs(self):
105 108
         Can find a file in a STATICFILES_DIRS directory.
106 109
         """
107 110
         self.assertFileContains('test.txt', 'Can we find')
  111
+        self.assertFileContains(os.path.join('prefix', 'test.txt'), 'Prefix')
108 112
 
109 113
     def test_staticfiles_dirs_subdir(self):
110 114
         """

0 notes on commit 21e0b3a

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