From 7e00c39a085e6801f01e043e841b7ef7b102a20f Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Tue, 25 May 2010 14:18:00 +0200 Subject: Move page templates into their own folder --- renderer.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'renderer.py') 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 :) -- cgit v1.2.3-70-g09d2