blob: 07e485b10d71bba3a779fef9924956e46c99887c (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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__)
|