From 782c4deffff72a8d9bcec20ae16128380ce0ace4 Mon Sep 17 00:00:00 2001 From: Birk Nilson Date: Fri, 2 Dec 2011 14:25:45 +0000 Subject: [PATCH] Fixed issue when slicing static_url version string when none exists. --- tornado/web.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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): -- 2.47.2