Permalink
Browse files

made it possible to render StaticURL UIModule with dont_optimize=True

  • Loading branch information...
peterbe committed Mar 21, 2012
1 parent c2b99ab commit e0e84bb59f05cefaef94396a17c0b1a85931ded1
Showing with 9 additions and 5 deletions.
  1. +9 −5 tornado_utils/tornado_static.py
@@ -8,7 +8,7 @@
(c) mail@peterbe.com
"""
-__version__ = '1.6'
+__version__ = '1.7'
import os
import cPickle
@@ -84,7 +84,7 @@ def save_name_conversion():
class StaticURL(tornado.web.UIModule):
- def render(self, *static_urls):
+ def render(self, *static_urls, **options):
# the following 4 lines will have to be run for every request. Since
# it's just a basic lookup on a dict it's going to be uber fast.
basic_name = ''.join(static_urls)
@@ -122,8 +122,11 @@ def render(self, *static_urls):
pass
else:
destination = file(new_name, 'w')
- do_optimize_static_content = self.handler.settings\
- .get('optimize_static_content', True)
+ if options.get('dont_optimize'):
+ do_optimize_static_content = False
+ else:
+ do_optimize_static_content = self.handler.settings\
+ .get('optimize_static_content', True)
if do_optimize_static_content:
uglifyjs_location = self.handler\
@@ -139,7 +142,8 @@ def render(self, *static_urls):
if full_path.endswith('.js'):
if len(full_paths) > 1:
destination.write('/* %s */\n' % os.path.basename(full_path))
- if do_optimize_static_content and not self._already_optimized_filename(full_path):
+ if (do_optimize_static_content and
+ not self._already_optimized_filename(full_path)):
optimization_done = True
if uglifyjs_location:
code = run_uglify_js_compiler(code, uglifyjs_location,

0 comments on commit e0e84bb

Please sign in to comment.