Mercurial > p > roundup > code
diff roundup/cgi/engine_zopetal.py @ 4740:fe9568a6cbd6
Untangle template selection logic from template loading functionality.
| author | anatoly techtonik <techtonik@gmail.com> |
|---|---|
| date | Tue, 15 Jan 2013 00:10:01 +0300 |
| parents | 94be76e04140 |
| children | 0421390b3094 |
line wrap: on
line diff
--- a/roundup/cgi/engine_zopetal.py Mon Jan 14 20:25:00 2013 +0300 +++ b/roundup/cgi/engine_zopetal.py Tue Jan 15 00:10:01 2013 +0300 @@ -8,7 +8,7 @@ import os import os.path -from roundup.cgi.templating import StringIO, context, translationService, find_template, LoaderBase +from roundup.cgi.templating import StringIO, context, translationService, LoaderBase from roundup.cgi.PageTemplates import PageTemplate, GlobalTranslationService from roundup.cgi.PageTemplates.Expressions import getEngine from roundup.cgi.TAL import TALInterpreter @@ -21,9 +21,16 @@ def __init__(self, dir): self.dir = dir - def load(self, name, view=None): + def check(self, name): + for extension in ['', '.html', '.xml']: + f = name + extension + src = os.path.join(self.dir, f) + if os.path.exists(src): + return (src, f) + + def load(self, tplname): # find the source - src, filename = find_template(self.dir, name, view) + src, filename = self.check(tplname) # has it changed? try:
