diff options
Diffstat (limited to 'renderer.py')
-rw-r--r-- | renderer.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/renderer.py b/renderer.py index 6f983a4..82068b7 100644 --- a/renderer.py +++ b/renderer.py @@ -17,9 +17,9 @@ class Renderer: output_encoding='utf-8', format_exceptions = True) - def render (self, tpl, **kwargs): + def render (self, tpl, level = "pages", **kwargs): try: - t = self.get_tpl(tpl) + t = self.get_tpl(tpl, level) except mako.exceptions.TopLevelLookupException, e: raise web.ctx.app_stack[-1].notfound(tpl) @@ -27,10 +27,12 @@ class Renderer: __call__ = render - def get_tpl (self, tpl): + def get_tpl (self, tpl, level = ""): if not tpl.endswith(".mako"): tpl = tpl+".mako" + tpl = os.path.join(level, tpl) + return self.lookup.get_template(tpl) # the one and only instance :) |