Commit d5a273ea authored by Claude Paroz's avatar Claude Paroz
Browse files

[1.7.x] 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.
Backport of 8b4cc9df from master.
parent 53bc81dc
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -216,10 +216,6 @@ class Command(NoArgsCommand):
        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
@@ -359,9 +355,11 @@ class Command(NoArgsCommand):
                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(force_text(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
@@ -131,3 +131,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