From: Birk Nilson Date: Fri, 2 Dec 2011 14:25:45 +0000 (+0000) Subject: Fixed issue when slicing static_url version string when none exists. X-Git-Tag: v2.2.0~11^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=782c4deffff72a8d9bcec20ae16128380ce0ace4;p=thirdparty%2Ftornado.git Fixed issue when slicing static_url version string when none exists. --- diff --git a/tornado/web.py b/tornado/web.py index 906b01284..d6a82d564 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -1542,7 +1542,6 @@ class StaticFileHandler(RequestHandler): ``settings`` is the `Application.settings` dictionary and ```path`` is the relative location of the requested asset on the filesystem. """ - hsh = None abs_path = os.path.join(settings["static_path"], path) with cls._lock: hashes = cls._static_hashes @@ -1554,8 +1553,10 @@ class StaticFileHandler(RequestHandler): except Exception: logging.error("Could not open static file %r", path) hashes[abs_path] = None - hsh = hashes.get(abs_path)[:5] - return hsh + hsh = hashes.get(abs_path) + if hsh: + return hsh[:5] + return None class FallbackHandler(RequestHandler):