Ticket #9722: 0001-Refactor-functionality-to-get-interesting-files-into.patch

File 0001-Refactor-functionality-to-get-interesting-files-into.patch, 1.2 KB (added by Chris Lamb, 16 years ago)
  • django/utils/autoreload.py

    From 819302a7ebb759e09c50d9bcbcd2a447895bbabf Mon Sep 17 00:00:00 2001
    From: Chris Lamb <lamby@debian.org>
    Date: Sun, 30 Nov 2008 00:43:03 +0000
    Subject: [PATCH] Refactor functionality to get interesting files into a seperate function.
    
    ---
     django/utils/autoreload.py |    8 ++++++--
     1 files changed, 6 insertions(+), 2 deletions(-)
    
    diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py
    index 8d9d6f2..4dbc945 100644
    a b RUN_RELOADER = True  
    4848_mtimes = {}
    4949_win = (sys.platform == "win32")
    5050
    51 def code_changed():
    52     global _mtimes, _win
     51def gen_filenames():
    5352    for filename in filter(lambda v: v, map(lambda m: getattr(m, "__file__", None), sys.modules.values())):
    5453        if filename.endswith(".pyc") or filename.endswith(".pyo"):
    5554            filename = filename[:-1]
    5655        if not os.path.exists(filename):
    5756            continue # File might be in an egg, so it can't be reloaded.
     57        yield filename
     58
     59def code_changed():
     60    global _mtimes, _win
     61    for filename in gen_filenames():
    5862        stat = os.stat(filename)
    5963        mtime = stat.st_mtime
    6064        if _win:
Back to Top