diff options
-rw-r--r-- | controller.py | 2 | ||||
-rw-r--r-- | renderer.py | 8 | ||||
-rw-r--r-- | templates/pages/add.mako (renamed from templates/add.mako) | 0 | ||||
-rw-r--r-- | templates/pages/edit.mako (renamed from templates/edit.mako) | 2 | ||||
-rw-r--r-- | templates/pages/show.mako (renamed from templates/show.mako) | 0 |
5 files changed, 7 insertions, 5 deletions
diff --git a/controller.py b/controller.py index 370391a..417046d 100644 --- a/controller.py +++ b/controller.py @@ -144,4 +144,4 @@ class FourOhFour: @staticmethod def catch (page = "?"): - return web.notfound(render("404", page = page)) + return web.notfound(render("404", level = "", page = page)) 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 :) diff --git a/templates/add.mako b/templates/pages/add.mako index ac67404..ac67404 100644 --- a/templates/add.mako +++ b/templates/pages/add.mako diff --git a/templates/edit.mako b/templates/pages/edit.mako index 09d5ea4..760c706 100644 --- a/templates/edit.mako +++ b/templates/pages/edit.mako @@ -1,4 +1,4 @@ -<%inherit file="/add.mako" /> +<%inherit file="add.mako" /> <%def name="heading()"> Edit expense diff --git a/templates/show.mako b/templates/pages/show.mako index dc23b9c..dc23b9c 100644 --- a/templates/show.mako +++ b/templates/pages/show.mako |