Permalink
Browse files

templates: rename get_template to get_web_template

updated webtools to use templates.get_web_template

replaced get_template with a jinja2.PackageLoader that loads from the
starcluster.templates package. these templates need to be updated before
using this new get_template function. likely will happen after next
release.
  • Loading branch information...
jtriley committed Jan 3, 2012
1 parent 7e1c3b0 commit b90f545f6c2e19becddaa0a7dc23ba5e6cae834e
Showing with 8 additions and 3 deletions.
  1. +7 −2 starcluster/templates/__init__.py
  2. +1 −1 starcluster/webtools.py
@@ -8,11 +8,16 @@
'user_msgs',
]
-loader = jinja2.Environment(loader=jinja2.PrefixLoader({
+_web_tmpl_loader = jinja2.Environment(loader=jinja2.PrefixLoader({
'web': jinja2.PackageLoader('starcluster.templates', 'web'),
}))
-get_template = loader.get_template
+get_web_template = _web_tmpl_loader.get_template
+
+_tmpl_loader = jinja2.Environment(
+ loader=jinja2.PackageLoader('starcluster', 'templates'))
+
+get_template = _tmpl_loader.get_template
def get_resource(pkg_data_path, stream=True):
View
@@ -109,7 +109,7 @@ def do_GET(self):
if relpath.endswith(self._bin_exts):
data = templates.get_resource(fullpath).read()
else:
- tmpl = templates.get_template(fullpath)
+ tmpl = templates.get_web_template(fullpath)
data = tmpl.render(**self._tmpl_context)
content_type = mimetypes.guess_type(os.path.basename(relpath))[0]
self.send_response(200)

0 comments on commit b90f545

Please sign in to comment.