diff --git a/r2/r2/config/middleware.py b/r2/r2/config/middleware.py index 40f38937a..a6049e77e 100644 --- a/r2/r2/config/middleware.py +++ b/r2/r2/config/middleware.py @@ -83,25 +83,6 @@ def error_mapper(code, message, environ, global_conf=None, **kw): url = '/error/document/?%s' % (urllib.urlencode(d)) return url -class StaticURLHashMiddleware(URLParser): - """Middleware for handling uniquely hashed static files. - - Filenames are matched against the g.static_names mapping, which is loaded - from names.json in the static dir. If a valid unique static filename is - requested, the hash is stripped from the filename before the request is - passed through to the StaticURLParser ``app``.""" - def __init__(self, app): - self.app = app - - def __call__(self, environ, start_response): - g = config['pylons.g'] - path_info = environ.get('PATH_INFO', '') - if path_info.startswith(g.static_path): - dirname, filename = os.path.split(path_info) - if filename in g.static_names_rev: - environ['PATH_INFO'] = os.path.join(dirname, g.static_names_rev[filename]) - return self.app(environ, start_response) - class DebugMiddleware(object): def __init__(self, app, keyword): self.app = app @@ -617,7 +598,6 @@ def make_app(global_conf, full_stack=True, **app_conf): # Static files javascripts_app = StaticJavascripts() static_app = StaticURLParser(config['pylons.paths']['static_files']) - #static_app = StaticURLHashMiddleware(static_app) app = Cascade([static_app, javascripts_app, app]) app = make_gzip_middleware(app, app_conf) diff --git a/r2/r2/lib/app_globals.py b/r2/r2/lib/app_globals.py index d111e12e9..ac3a710b7 100644 --- a/r2/r2/lib/app_globals.py +++ b/r2/r2/lib/app_globals.py @@ -285,9 +285,6 @@ class Globals(object): if os.path.exists(names_file_path): with open(names_file_path) as handle: self.static_names = json.load(handle) - # Generate a reverse mapping dictionary so that we can check - # unique filenames in StaticURLHashMiddleware - self.static_names_rev = dict((v, k) for k, v in self.static_names.iteritems()) else: self.static_names = {}