template: refactor template.ezt lookup (#7209)
This commit is contained in:
parent
94868cd068
commit
f03781948a
|
@ -363,22 +363,21 @@ def decorate(body, response):
|
|||
possible_filenames.append('template.%s.ezt' % get_publisher().APP_NAME)
|
||||
possible_filenames.append('template.ezt')
|
||||
|
||||
possible_dirnames = [
|
||||
os.path.join(get_publisher().app_dir, 'themes', current_theme),
|
||||
os.path.join(get_publisher().data_dir, 'themes', current_theme),
|
||||
os.path.join(get_publisher().data_dir, 'themes', 'default'),
|
||||
]
|
||||
|
||||
for fname in possible_filenames:
|
||||
filename = os.path.join(get_publisher().app_dir, 'themes',
|
||||
current_theme, fname)
|
||||
if os.path.exists(filename):
|
||||
template_ezt = file(filename).read()
|
||||
break
|
||||
filename = os.path.join(get_publisher().data_dir, 'themes',
|
||||
current_theme, fname)
|
||||
if os.path.exists(filename):
|
||||
template_ezt = file(filename).read()
|
||||
break
|
||||
filename = os.path.join(get_publisher().data_dir, 'themes',
|
||||
'default', fname)
|
||||
if os.path.exists(filename):
|
||||
template_ezt = file(filename).read()
|
||||
break
|
||||
for dname in possible_dirnames:
|
||||
filename = os.path.join(dname, fname)
|
||||
if os.path.exists(filename):
|
||||
template_ezt = file(filename).read()
|
||||
break
|
||||
else:
|
||||
continue
|
||||
break
|
||||
|
||||
if template_ezt:
|
||||
generate_breadcrumb = ('[breadcrumb]' in template_ezt)
|
||||
|
|
Loading…
Reference in New Issue