Skip to content

Commit

Permalink
Make the tests working
Browse files Browse the repository at this point in the history
  • Loading branch information
Fantomas42 committed Jul 22, 2014
1 parent 9543774 commit 40b0bc4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app_namespace/loader.py
Expand Up @@ -64,23 +64,25 @@ def load_template_source(self, template_name, template_dirs=None):
for app in self.app_templates_dirs:
try:
return self.load_template_source_inner(
template_name, app, template_path)
template_name, app, template_path, True)
except TemplateDoesNotExist:
pass
raise TemplateDoesNotExist(template_name)
else:
return self.load_template_source_inner(
template_name, app, template_path)

def load_template_source_inner(self, template_name, app, template_path):
def load_template_source_inner(self, template_name, app, template_path,
empty_namespace=False):
try:
file_path = safe_join(self.app_templates_dirs[app],
template_path)
if file_path in self.path_already_used:
if empty_namespace and file_path in self.path_already_used:
raise TemplateDoesNotExist(template_name)
with open(file_path, 'rb') as fp:
template = fp.read().decode(settings.FILE_CHARSET)
self.path_already_used.append(file_path)
if empty_namespace:
self.path_already_used.append(file_path)
return (template, 'app_namespace:%s:%s' % (app, file_path))

except (IOError, KeyError, ValueError):
Expand Down

0 comments on commit 40b0bc4

Please sign in to comment.