Mercurial > p > roundup > code
changeset 4748:e339583eae8e
templating: rename precompileTemplates to precompile
| author | anatoly techtonik <techtonik@gmail.com> |
|---|---|
| date | Mon, 21 Jan 2013 23:51:39 +0300 |
| parents | 955860a18e12 |
| children | 0421390b3094 |
| files | roundup/cgi/engine_jinja2.py roundup/cgi/templating.py roundup/instance.py |
| diffstat | 3 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/roundup/cgi/engine_jinja2.py Mon Jan 21 23:04:55 2013 +0300 +++ b/roundup/cgi/engine_jinja2.py Mon Jan 21 23:51:39 2013 +0300 @@ -25,7 +25,7 @@ [ ] figure out what to do with autoescaping - it is disabled by default in Jinja2 -[ ] precompileTemplates is a stub +[ ] precompile() is a stub [ ] add {{ debug() }} dumper to inspect available variables https://github.com/mitsuhiko/jinja2/issues/174 @@ -59,7 +59,7 @@ #src, filename = self.check(tplname) return Jinja2ProxyPageTemplate(self._env.get_template(tplname + '.html')) - def precompileTemplates(self): + def precompile(self): pass class Jinja2ProxyPageTemplate(TemplateBase):
--- a/roundup/cgi/templating.py Mon Jan 21 23:04:55 2013 +0300 +++ b/roundup/cgi/templating.py Mon Jan 21 23:51:39 2013 +0300 @@ -84,9 +84,11 @@ # loaders are given the template directory as a first argument pass - def precompileTemplates(self): - """ Go through a directory and precompile all the templates therein + def precompile(self): + """ This method may be called when tracker is loaded to precompile + templates that support this ability. """ + # [ ] move implementation out of API for filename in os.listdir(self.dir): # skip subdirs if os.path.isdir(filename): @@ -120,6 +122,7 @@ def __getitem__(self, name): """Special method to access templates by loader['name']""" + # [ ] not sure if it is needed for anything except TAL templates try: return self.load(name) except NoTemplate, message:
--- a/roundup/instance.py Mon Jan 21 23:04:55 2013 +0300 +++ b/roundup/instance.py Mon Jan 21 23:51:39 2013 +0300 @@ -66,7 +66,7 @@ self.backend = backends.get_backend(self.get_backend_name()) if self.optimize: - self.templates.precompileTemplates() + self.templates.precompile() # initialize tracker extensions for extension in self.get_extensions('extensions'): extension(self) @@ -290,7 +290,7 @@ tracker.optimize = optimize tracker.templates = templating.get_loader(tracker.config["TEMPLATES"]) if optimize: - tracker.templates.precompileTemplates() + tracker.templates.precompile() return tracker
