Index: sitescripts/cms/converters.py |
=================================================================== |
--- a/sitescripts/cms/converters.py |
+++ b/sitescripts/cms/converters.py |
@@ -172,6 +172,16 @@ |
return result |
class TemplateConverter(Converter): |
+ class _SourceLoader(jinja2.BaseLoader): |
+ def __init__(self, source): |
+ self.source = source |
+ |
+ def get_source(self, environment, template): |
+ try: |
+ return self.source.read_include(template, "tmpl"), None, None |
+ except Exception: |
+ raise jinja2.TemplateNotFound(template) |
+ |
def __init__(self, *args, **kwargs): |
Converter.__init__(self, *args, **kwargs) |
@@ -197,7 +207,7 @@ |
filters[func] = getattr(module, func) |
filters[func].module_ref = module # Prevent garbage collection |
- self._env = get_custom_template_environment(filters) |
+ self._env = get_custom_template_environment(filters, self._SourceLoader(self._params["source"])) |
def get_html(self, source): |
template = self._env.from_string(source) |