[svn] simplified code that calculates the import filename
authorArmin Ronacher <armin.ronacher@active-4.com>
Tue, 29 May 2007 22:05:24 +0000 (00:05 +0200)
committerArmin Ronacher <armin.ronacher@active-4.com>
Tue, 29 May 2007 22:05:24 +0000 (00:05 +0200)
--HG--
branch : trunk

jinja/loaders.py
tests/loaderres/templates/foo/test.html [new file with mode: 0644]
tests/test_loaders.py

index ae93aaa1ef23d90ed564ebe5cd6b32c09069f578..0784ed59eafee9fb10c293c043d78601e89f2f52 100644 (file)
@@ -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 (file)
index 0000000..b7d6715
--- /dev/null
@@ -0,0 +1 @@
+FOO
index ad1e7b0d82a6dcfb680e59eb202ecbd8bab0bf3a..32cf8fe33f815bc465645afaab173d8ca2e37c3d 100644 (file)
@@ -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: