Ticket #6863: autoreload_sources.diff

File autoreload_sources.diff, 1.1 KB (added by groves, 16 years ago)
  • django/utils/autoreload.py

     
    2828# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    2929# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    3030
    31 import os, sys, time
     31import itertools, os, sys, time
    3232
    3333try:
    3434    import thread
     
    4545
    4646RUN_RELOADER = True
    4747
     48def get_module_files():
     49    return filter(None, map(lambda m: getattr(m, "__file__", None), sys.modules.values()))
     50
     51sources = [get_module_files]
     52
    4853def reloader_thread():
    4954    mtimes = {}
    5055    win = (sys.platform == "win32")
    5156    while RUN_RELOADER:
    52         for filename in filter(lambda v: v, map(lambda m: getattr(m, "__file__", None), sys.modules.values())):
     57        for filename in itertools.chain(*[source() for source in sources]):
    5358            if filename.endswith(".pyc") or filename.endswith("*.pyo"):
    5459                filename = filename[:-1]
    5560            if not os.path.exists(filename):
Back to Top