From cb58db15748217ab68e9c4f35bb182edbc202e70 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Wed, 30 May 2007 00:05:24 +0200 Subject: [PATCH] [svn] simplified code that calculates the import filename --HG-- branch : trunk --- jinja/loaders.py | 4 ++-- tests/loaderres/templates/foo/test.html | 1 + tests/test_loaders.py | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 tests/loaderres/templates/foo/test.html diff --git a/jinja/loaders.py b/jinja/loaders.py index ae93aaa..0784ed5 100644 --- a/jinja/loaders.py +++ b/jinja/loaders.py @@ -29,8 +29,8 @@ def get_template_filename(searchpath, name): """ Return the filesystem filename wanted. """ - return path.join(searchpath, path.sep.join([p for p in name.split('/') - if p and p[0] != '.'])) + return path.join(searchpath, *[p for p in name.split('/') + if p and p[0] != '.']) def get_cachename(cachepath, name, salt=None): diff --git a/tests/loaderres/templates/foo/test.html b/tests/loaderres/templates/foo/test.html new file mode 100644 index 0000000..b7d6715 --- /dev/null +++ b/tests/loaderres/templates/foo/test.html @@ -0,0 +1 @@ +FOO diff --git a/tests/test_loaders.py b/tests/test_loaders.py index ad1e7b0..32cf8fe 100644 --- a/tests/test_loaders.py +++ b/tests/test_loaders.py @@ -58,6 +58,8 @@ def test_filesystem_loader(): env = Environment(loader=filesystem_loader) tmpl = env.get_template('test.html') assert tmpl.render().strip() == 'BAR' + tmpl = env.get_template('foo/test.html') + assert tmpl.render().strip() == 'FOO' try: env.get_template('missing.html') except TemplateNotFound: -- 2.26.2