diff options
author | Sam Ockman | 2012-05-24 02:18:20 -0400 |
---|---|---|
committer | Sam Ockman | 2012-05-24 02:18:20 -0400 |
commit | 527bb0459cf488e5021696e326dc10d28ecdd74c (patch) | |
tree | 097e013d6a876fe0a6e178ff6defa813faa4af93 /wqflask/base/JinjaPage.py | |
parent | aa915612d2ff98f1e31d2ec38e8054382ef75dd9 (diff) | |
download | genenetwork2-527bb0459cf488e5021696e326dc10d28ecdd74c.tar.gz |
Trying to get stuff working under new structure
Diffstat (limited to 'wqflask/base/JinjaPage.py')
-rw-r--r-- | wqflask/base/JinjaPage.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/wqflask/base/JinjaPage.py b/wqflask/base/JinjaPage.py new file mode 100644 index 00000000..07e485b1 --- /dev/null +++ b/wqflask/base/JinjaPage.py @@ -0,0 +1,28 @@ +import logging +logging.basicConfig(filename="/tmp/gn_log", level=logging.INFO) +_log = logging.getLogger("search") + +from pprint import pformat as pf + +import templatePage + +from utility import formatting + +import jinja2 +JinjaEnv = jinja2.Environment(loader=jinja2.FileSystemLoader('/gnshare/gn/web/webqtl/templates')) +JinjaEnv.globals['numify'] = formatting.numify + + +class JinjaPage(templatePage.templatePage): + """Class derived from our regular templatePage, but uses Jinja2 instead. + + When converting pages from Python generated templates, change the base class from templatePage + to JinjaPage + + """ + + + def write(self): + """We override the base template write so we can use Jinja2.""" + _log.info(pf(self.__dict__)) + return self.jtemplate.render(**self.__dict__) |