]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
CSS/JS embeds after files
authorBret Taylor <btaylor@gmail.com>
Wed, 30 Sep 2009 07:32:40 +0000 (00:32 -0700)
committerBret Taylor <btaylor@gmail.com>
Wed, 30 Sep 2009 07:32:40 +0000 (00:32 -0700)
tornado/web.py

index 08047a4e30c7d899e050e3bfb6e89fc674eb9487..48db9ffa395883e81097f3a756be1ccf47dc0090 100644 (file)
@@ -325,11 +325,6 @@ class RequestHandler(object):
                     css_files.extend(file_part)
             head_part = module.html_head()
             if head_part: html_heads.append(_utf8(head_part))
-        if js_embed:
-            js_embed = '<script type="text/javascript">\n//<![CDATA[\n' + \
-                '\n'.join(js_embed) + '\n//]]>\n</script>'
-            sloc = html.rindex('</body>')
-            html = html[:sloc] + js_embed + '\n' + html[sloc:]
         if js_files:
             paths = set()
             for path in js_files:
@@ -342,11 +337,11 @@ class RequestHandler(object):
                                  for p in paths)
             sloc = html.rindex('</body>')
             html = html[:sloc] + js_embed + '\n' + html[sloc:]
-        if css_embed:
-            css_embed = '<style type="text/css">\n' + '\n'.join(css_embed) + \
-                '\n</style>'
-            hloc = html.index('</head>')
-            html = html[:hloc] + css_embed + '\n' + html[hloc:]
+        if js_embed:
+            js_embed = '<script type="text/javascript">\n//<![CDATA[\n' + \
+                '\n'.join(js_embed) + '\n//]]>\n</script>'
+            sloc = html.rindex('</body>')
+            html = html[:sloc] + js_embed + '\n' + html[sloc:]
         if css_files:
             paths = set()
             for path in css_files:
@@ -359,6 +354,11 @@ class RequestHandler(object):
                                 for p in paths)
             hloc = html.index('</head>')
             html = html[:hloc] + css_embed + '\n' + html[hloc:]
+        if css_embed:
+            css_embed = '<style type="text/css">\n' + '\n'.join(css_embed) + \
+                '\n</style>'
+            hloc = html.index('</head>')
+            html = html[:hloc] + css_embed + '\n' + html[hloc:]
         if html_heads:
             hloc = html.index('</head>')
             html = html[:hloc] + ''.join(html_heads) + '\n' + html[hloc:]