Mercurial > hg > GlobalNeighbors
view globalneighbors/template.py @ 7:254195d0bac2
partial implementation of autocomplete using jqueryui; easyautocomplete.com may be more what we want
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sun, 25 Jun 2017 09:13:48 -0700 |
parents | 316e1d54ffd4 |
children |
line wrap: on
line source
""" functionality for `jinja` templates """ import os from jinja2 import Template # default template location here = os.path.dirname(os.path.abspath(__file__)) template_dir = os.path.join(here, 'templates') class TemplateLoader(object): def __init__(self, template_dir=template_dir): assert os.path.exists(template_dir) self.template_dir = template_dir def load(self, template): path = os.path.join(self.template_dir, template) assert os.path.exists(path) with open(path) as f: return Template(f.read())