misc: pylint fix using-constant-test (#52222)

This commit is contained in:
Lauréline Guérin 2021-03-22 11:27:05 +01:00
parent d88dd530f6
commit 021b73d4fb
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
1 changed files with 21 additions and 22 deletions

View File

@ -380,30 +380,29 @@ def decorate(body, response):
from .publisher import get_cfg
generate_breadcrumb = True
if True:
template_ezt = get_cfg('branding', {}).get('template')
current_theme = get_cfg('branding', {}).get('theme', 'default')
if not template_ezt:
# the theme can provide a default template
possible_filenames = []
possible_filenames.append('template.%s.ezt' % get_publisher().APP_NAME)
possible_filenames.append('template.ezt')
template_ezt = get_cfg('branding', {}).get('template')
current_theme = get_cfg('branding', {}).get('theme', 'default')
if not template_ezt:
# the theme can provide a default template
possible_filenames = []
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'),
]
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:
for dname in possible_dirnames:
filename = os.path.join(dname, fname)
if os.path.exists(filename):
template_ezt = open(filename).read()
break
else:
continue
break
for fname in possible_filenames:
for dname in possible_dirnames:
filename = os.path.join(dname, fname)
if os.path.exists(filename):
template_ezt = open(filename).read()
break
else:
continue
break
if template_ezt:
generate_breadcrumb = '[breadcrumb]' in template_ezt