Remove static url hash middleware since we now generate named symlinks.

This commit is contained in:
Max Goodman
2011-06-16 15:00:04 -07:00
parent beb970fd56
commit 55617ffc8f
2 changed files with 0 additions and 23 deletions

View File

@@ -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)

View File

@@ -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 = {}