From 3f8ba8dd513073a44e6b4639bc736aaadc25e922 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Thu, 15 Mar 2007 21:46:28 +0100 Subject: [PATCH] [svn] small baker changes --HG-- branch : trunk --- docs/src/frameworks.txt | 11 +++++++++++ jinja/bakerplugin.py | 6 ++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/src/frameworks.txt b/docs/src/frameworks.txt index 5efd7f0..cc3eb70 100644 --- a/docs/src/frameworks.txt +++ b/docs/src/frameworks.txt @@ -38,6 +38,17 @@ You can override this using ``jinja.exception``. eg: 'jinja.extension': 'tmpl' }) +Note that you have to use a trailing slash to load templates if you want to +specify the extension. Otherwise use the dotted notation: + +.. sourcecode:: python + + render_template('/index.html') + render_template('index') + + render_template('/modules/userlist.html') + render_template('modules.userlist') + TurboGears ---------- diff --git a/jinja/bakerplugin.py b/jinja/bakerplugin.py index 81edeb9..a0525bd 100644 --- a/jinja/bakerplugin.py +++ b/jinja/bakerplugin.py @@ -48,8 +48,10 @@ class JinjaPlugin(object): return self.environment.from_string(template_string) # Translate TG dot notation to normal / template path - if '/' not in templatename and '.' in templatename: - templatename = '/' + templatename.replace('.', '/') + '.' + self.extension + if templatename.startswith('/'): + templatename = templatename[1:] + else: + templatename = templatename.replace('.', '/') + '.' + self.extension return self.environment.get_template(templatename) -- 2.26.2