Ticket #6863: autoreload_sources.diff
File autoreload_sources.diff, 1.1 KB (added by , 17 years ago) |
---|
-
django/utils/autoreload.py
28 28 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 30 31 import os, sys, time31 import itertools, os, sys, time 32 32 33 33 try: 34 34 import thread … … 45 45 46 46 RUN_RELOADER = True 47 47 48 def get_module_files(): 49 return filter(None, map(lambda m: getattr(m, "__file__", None), sys.modules.values())) 50 51 sources = [get_module_files] 52 48 53 def reloader_thread(): 49 54 mtimes = {} 50 55 win = (sys.platform == "win32") 51 56 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]): 53 58 if filename.endswith(".pyc") or filename.endswith("*.pyo"): 54 59 filename = filename[:-1] 55 60 if not os.path.exists(filename):