diff options
| author | Claude Paroz <claude@2xlibre.net> | 2014-07-14 21:40:55 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2014-07-15 09:59:25 +0200 |
| commit | f2011e21a2d803ab6328852c3af4a4bf6701b11d (patch) | |
| tree | 8ffe12a1d5b9371108d0b2b5994f346f3a2d9115 /django/utils | |
| parent | 6d5238f6c873f8ad652ee206b88849a50e68accc (diff) | |
[1.7.x] Fixed #22991 -- Prevented *.pyc files in autoreload monitoring
This fixes a regression introduced in 6d302f639.
Thanks lorinkoz at gmail.com for the report, Collin Anderson
for the initial patch and Simon Charette for the review.
Backport of 4e424084e from master.
Diffstat (limited to 'django/utils')
| -rw-r--r-- | django/utils/autoreload.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py index 1037eff384..b232a51fa0 100644 --- a/django/utils/autoreload.py +++ b/django/utils/autoreload.py @@ -96,8 +96,9 @@ def gen_filenames(only_new=False): return _cached_filenames new_modules = module_values - _cached_modules - new_filenames = [filename.__file__ for filename in new_modules - if hasattr(filename, '__file__')] + new_filenames = clean_files( + [filename.__file__ for filename in new_modules + if hasattr(filename, '__file__')]) if not _cached_filenames and settings.USE_I18N: # Add the names of the .mo files that can be generated @@ -116,10 +117,15 @@ def gen_filenames(only_new=False): if filename.endswith('.mo'): new_filenames.append(os.path.join(dirpath, filename)) + _cached_modules = _cached_modules.union(new_modules) + _cached_filenames += new_filenames if only_new: - filelist = new_filenames + return new_filenames else: - filelist = _cached_filenames + new_filenames + _error_files + return _cached_filenames + clean_files(_error_files) + + +def clean_files(filelist): filenames = [] for filename in filelist: if not filename: @@ -130,8 +136,6 @@ def gen_filenames(only_new=False): filename = filename[:-9] + ".py" if os.path.exists(filename): filenames.append(filename) - _cached_modules = _cached_modules.union(new_modules) - _cached_filenames += new_filenames return filenames |
