Ticket #23083: 23083.diff

File 23083.diff, 1.0 KB (added by Tim Graham, 5 years ago)
  • django/utils/autoreload.py

    diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py
    index 3ac8c1f..27e19a7 100644
    a b def inotify_code_changed(): 
    198198    return EventHandler.modified_code
    199199
    200200
     201def get_file_modified_type(filename):
     202    return I18N_MODIFIED if filename.endswith('.mo') else FILE_MODIFIED
     203
     204
    201205def code_changed():
    202206    global _mtimes, _win
    203207    for filename in gen_filenames():
    204         stat = os.stat(filename)
     208        try:
     209            stat = os.stat(filename)
     210        except OSError:
     211            # in case a file is deleted
     212            return get_file_modified_type(filename)
    205213        mtime = stat.st_mtime
    206214        if _win:
    207215            mtime -= stat.st_ctime
    def code_changed(): 
    214222                del _error_files[_error_files.index(filename)]
    215223            except ValueError:
    216224                pass
    217             return I18N_MODIFIED if filename.endswith('.mo') else FILE_MODIFIED
     225            return get_file_modified_type(filename)
    218226    return False
    219227
    220228
Back to Top