def get_template_sources(self, template_name):
# If the cookie doesn't exist, set it to the default theme
default_theme = get_default_theme()
theme = getattr(_local, 'theme', default_theme)
this_theme = find_theme(theme)
# If the theme is not valid, check the default theme ...
if not this_theme:
this_theme = find_theme(get_default_theme())
# If the theme is still not valid, then move along ...
# these aren't the templates you are looking for
if not this_theme:
pass
try:
if not template_name.startswith('/'):
try:
yield safe_join(
'openstack_dashboard',
this_theme[2],
'templates',
template_name
)
except SuspiciousFileOperation:
yield os.path.join(
this_theme[2], 'templates', template_name
)
except UnicodeDecodeError:
# The template dir name wasn't valid UTF-8.
raise
except ValueError:
# The joined path was located outside of template_dir.
pass
评论列表
文章目录