From: Ben Darnell Date: Sun, 1 May 2011 18:59:11 +0000 (-0700) Subject: Support https for UIModule javascript_files and css_files. X-Git-Tag: v2.0.0~94 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bae1b57193e4c1f4ef19dd284b45dbbd693d2668;p=thirdparty%2Ftornado.git Support https for UIModule javascript_files and css_files. Closes #256. --- diff --git a/tornado/web.py b/tornado/web.py index 755ccd0a4..c30c9851f 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -446,12 +446,14 @@ class RequestHandler(object): if head_part: html_heads.append(_utf8(head_part)) body_part = module.html_body() if body_part: html_bodies.append(_utf8(body_part)) + def is_absolute(path): + return any(path.startswith(x) for x in ["/", "http:", "https:"]) if js_files: # Maintain order of JavaScript files given by modules paths = [] unique_paths = set() for path in js_files: - if not path.startswith("/") and not path.startswith("http:"): + if not is_absolute(path): path = self.static_url(path) if path not in unique_paths: paths.append(path) @@ -470,7 +472,7 @@ class RequestHandler(object): paths = [] unique_paths = set() for path in css_files: - if not path.startswith("/") and not path.startswith("http:"): + if not is_absolute(path): path = self.static_url(path) if path not in unique_paths: paths.append(path)