From: Armin Ronacher Date: Thu, 15 Mar 2007 20:46:28 +0000 (+0100) Subject: [svn] small baker changes X-Git-Tag: 2.0rc1~429 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3f8ba8dd513073a44e6b4639bc736aaadc25e922;p=jinja2.git [svn] small baker changes --HG-- branch : trunk --- 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)