Permalink
Browse files

removed reloader from http.py. It has been moved to application.py

  • Loading branch information...
1 parent e150793 commit bb3ab9e703008dacfe8556e767bcfbd3920d3d7d @anandology anandology committed Nov 10, 2008
Showing with 1 addition and 54 deletions.
  1. +1 −54 web/http.py
View
55 web/http.py
@@ -9,7 +9,7 @@
"write",
"changequery", "url",
"background", "backgrounder",
- "Reloader", "reloader", "profiler",
+ "profiler",
]
import sys, os, threading, urllib, urlparse
@@ -165,59 +165,6 @@ def internal(*a, **kw):
return func(*a, **kw)
return internal
-class Reloader:
- """
- Before every request, checks to see if any loaded modules have changed on
- disk and, if so, reloads them.
- """
- def __init__(self, func):
- self.func = func
- self.mtimes = {}
- # cheetah:
- # b = _compiletemplate.bases
- # _compiletemplate = globals()['__compiletemplate']
- # _compiletemplate.bases = b
-
- #web.loadhooks['reloader'] = self.check
- # todo:
- # - replace relrcheck with a loadhook
- #if reloader in middleware:
- # relr = reloader(None)
- # relrcheck = relr.check
- # middleware.remove(reloader)
- #else:
- # relr = None
- # relrcheck = lambda: None
- # if relr:
- # relr.func = wsgifunc
- # return wsgifunc
- #
-
- def check(self):
- for mod in sys.modules.values():
- try:
- mtime = os.stat(mod.__file__).st_mtime
- except (AttributeError, OSError, IOError):
- continue
- if mod.__file__.endswith('.pyc') and \
- os.path.exists(mod.__file__[:-1]):
- mtime = max(os.stat(mod.__file__[:-1]).st_mtime, mtime)
- if mod not in self.mtimes:
- self.mtimes[mod] = mtime
- elif self.mtimes[mod] < mtime:
- try:
- reload(mod)
- self.mtimes[mod] = mtime
- except ImportError:
- pass
- return True
-
- def __call__(self, e, o):
- self.check()
- return self.func(e, o)
-
-reloader = Reloader
-
def profiler(app):
"""Outputs basic profiling information at the bottom of each response."""
from utils import profile

0 comments on commit bb3ab9e

Please sign in to comment.