Permalink
Browse files

Only find template class if we've found the file.

  • Loading branch information...
1 parent 02f08b2 commit f961ab0ae99286b26409157f1032eb58d432360e Michael Gorven committed Jul 11, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 web/contrib/template.py
@@ -137,9 +137,9 @@ def _get_template(self, name, from_template=None):
for directory in self.directories:
for extension in self.extensions:
filename = os.path.join(directory, name + extension)
- if not from_template:
- from_template = getattr(tempita, self.extensions[extension][0])
if os.path.exists(filename):
+ if not from_template:
+ from_template = getattr(tempita, self.extensions[extension][0])
template = from_template.from_filename(filename, get_template=self._get_template)
template.content_type = self.extensions[extension][1]
return template

0 comments on commit f961ab0

Please sign in to comment.