From aa836cdf3952d52efc68201872b3a0053aca33ad Mon Sep 17 00:00:00 2001 From: Bret Taylor Date: Wed, 30 Sep 2009 00:32:40 -0700 Subject: [PATCH] CSS/JS embeds after files --- tornado/web.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tornado/web.py b/tornado/web.py index 08047a4e30..48db9ffa39 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -325,11 +325,6 @@ def render(self, template_name, **kwargs): css_files.extend(file_part) head_part = module.html_head() if head_part: html_heads.append(_utf8(head_part)) - if js_embed: - js_embed = '' - sloc = html.rindex('') - html = html[:sloc] + js_embed + '\n' + html[sloc:] if js_files: paths = set() for path in js_files: @@ -342,11 +337,11 @@ def render(self, template_name, **kwargs): for p in paths) sloc = html.rindex('') html = html[:sloc] + js_embed + '\n' + html[sloc:] - if css_embed: - css_embed = '' - hloc = html.index('') - html = html[:hloc] + css_embed + '\n' + html[hloc:] + if js_embed: + js_embed = '' + sloc = html.rindex('') + html = html[:sloc] + js_embed + '\n' + html[sloc:] if css_files: paths = set() for path in css_files: @@ -359,6 +354,11 @@ def render(self, template_name, **kwargs): for p in paths) hloc = html.index('') html = html[:hloc] + css_embed + '\n' + html[hloc:] + if css_embed: + css_embed = '' + hloc = html.index('') + html = html[:hloc] + css_embed + '\n' + html[hloc:] if html_heads: hloc = html.index('') html = html[:hloc] + ''.join(html_heads) + '\n' + html[hloc:]