| Index: sitescripts/cms/sources.py |
| =================================================================== |
| --- a/sitescripts/cms/sources.py |
| +++ b/sitescripts/cms/sources.py |
| @@ -18,6 +18,7 @@ |
| import sys, os, subprocess, zipfile, json, urlparse, codecs |
| from StringIO import StringIO |
| from ConfigParser import SafeConfigParser |
| +import jinja2 |
| class Source: |
| def resolve_link(self, url, locale): |
| @@ -166,6 +167,9 @@ |
| def read_template(self, template): |
| return self.read_file(self.template_filename(template)) |
| + def get_template_loader(self): |
| + return SourceLoader(self) |
| + |
| # |
| # Include helpers |
| # |
| @@ -259,3 +263,13 @@ |
| do_list(path, relpath + filename + "/") |
| do_list(self.get_path(subdir), "") |
| return result |
| + |
| +class SourceLoader(jinja2.BaseLoader): |
|
Wladimir Palant
2013/12/11 18:46:02
I don't think that Jinja-specific functionality be
|
| + def __init__(self, source): |
| + self.source = source |
| + |
| + def get_source(self, environment, template): |
| + try: |
| + return self.source.read_file(template + '.tmpl'), None, None |
|
Wladimir Palant
2013/12/11 18:46:02
I think this should be self.source.read_include(te
Sebastian Noack
2013/12/11 22:20:14
I've already addressed that, but I would like to u
Wladimir Palant
2013/12/12 07:16:54
Yes, you are right. We might want to extend the de
|
| + except Exception: |
| + raise jinja2.TemplateNotFound(template) |