Commit 8b4cc9df authored by Claude Paroz's avatar Claude Paroz
Browse files

Fixed #23583 -- More selectively ignored static/media roots

Fixed a regression introduced by 28efafa2.
Thanks Michal Čihař for the report and initial patch, and
Collin Anderson and Tim Graham for the reviews.
parent c34e13e1
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -227,10 +227,6 @@ class Command(BaseCommand):
        ignore_patterns = options.get('ignore_patterns')
        if options.get('use_default_ignore_patterns'):
            ignore_patterns += ['CVS', '.*', '*~', '*.pyc']
        base_path = os.path.abspath('.')
        for path in (settings.MEDIA_ROOT, settings.STATIC_ROOT):
            if path and path.startswith(base_path):
                ignore_patterns.append('%s*' % path[len(base_path) + 1:])
        self.ignore_patterns = list(set(ignore_patterns))

        # Avoid messing with mutable class variables
@@ -376,9 +372,11 @@ class Command(BaseCommand):
                norm_patterns.append(p)

        all_files = []
        ignored_roots = [os.path.normpath(p) for p in (settings.MEDIA_ROOT, settings.STATIC_ROOT)]
        for dirpath, dirnames, filenames in os.walk(root, topdown=True, followlinks=self.symlinks):
            for dirname in dirnames[:]:
                if is_ignored(os.path.normpath(os.path.join(dirpath, dirname)), norm_patterns):
                if (is_ignored(os.path.normpath(os.path.join(dirpath, dirname)), norm_patterns) or
                        os.path.join(os.path.abspath(dirpath), dirname) in ignored_roots):
                    dirnames.remove(dirname)
                    if self.verbosity > 1:
                        self.stdout.write('ignoring directory %s\n' % dirname)
+3 −0
Original line number Diff line number Diff line
@@ -132,3 +132,6 @@ Bugfixes

* Fixed a regression when feeding the Django test client with an empty data
  string (:ticket:`21740`).

* Fixed a regression in :djadmin:`makemessages` where static files were
  unexpectedly ignored (:ticket:`23583`).
+1 −0
Original line number Diff line number Diff line
gettext('Static content inside app should be included.')
+1 −0
Original line number Diff line number Diff line
gettext('Content from STATIC_ROOT should not be included.')
Loading