Skip to content

Commit

Permalink
More readable version of the code
Browse files Browse the repository at this point in the history
  • Loading branch information
Fantomas42 committed Jul 23, 2014
1 parent d071dc8 commit 9476b91
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions app_namespace/loader.py
Expand Up @@ -76,23 +76,23 @@ def load_template_source(self, template_name, template_dirs=None):

app, template_path = template_name.split(':')

if app == '':
for app in self.app_templates_dirs:
file_path = self.get_app_template_path(app, template_path)
if file_path in self._already_used:
continue
try:
template = self.load_template_source_inner(
template_name, app, template_path)
self._already_used.append(file_path)
return template
except TemplateDoesNotExist:
pass
raise TemplateDoesNotExist(template_name)

return self.load_template_source_inner(
if app:
return self.load_template_source_inner(
template_name, app, template_path)

for app in self.app_templates_dirs:
file_path = self.get_app_template_path(app, template_path)
if file_path in self._already_used:
continue
try:
template = self.load_template_source_inner(
template_name, app, template_path)
self._already_used.append(file_path)
return template
except TemplateDoesNotExist:
pass
raise TemplateDoesNotExist(template_name)

def load_template_source_inner(self, template_name, app, template_path):
"""
Try to load 'template_path' in the templates directory of 'app'.
Expand Down

0 comments on commit 9476b91

Please sign in to comment.