]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Support https for UIModule javascript_files and css_files.
authorBen Darnell <ben@bendarnell.com>
Sun, 1 May 2011 18:59:11 +0000 (11:59 -0700)
committerBen Darnell <ben@bendarnell.com>
Sun, 1 May 2011 18:59:11 +0000 (11:59 -0700)
Closes #256.

tornado/web.py

index 755ccd0a4410e8f46064534e8ecd31e9c80124a0..c30c9851f8b4cd55a22335383f4c3a14191bb83e 100644 (file)
@@ -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)