From: Armin Ronacher Date: Tue, 29 May 2007 22:05:24 +0000 (+0200) Subject: [svn] simplified code that calculates the import filename X-Git-Tag: 2.0rc1~310 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=cb58db15748217ab68e9c4f35bb182edbc202e70;p=jinja2.git [svn] simplified code that calculates the import filename --HG-- branch : trunk --- 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: