misc: fully disable complex data support if feature flag is off (#50184)

This commit is contained in:
Frédéric Péters 2021-01-15 15:44:15 +01:00
parent d2aff90e9a
commit f6850ef0e8
2 changed files with 2 additions and 2 deletions

View File

@ -117,7 +117,7 @@ if not hasattr(django.template.base, '_monkeypatched'):
orig_render_value_in_context = django.template.base.render_value_in_context
def new_render_value_in_context(value, context):
if 'allow_complex' in context and not isinstance(value, str):
if context.get('allow_complex') and not isinstance(value, str):
return get_publisher().cache_complex_data(value)
return orig_render_value_in_context(value, context)

View File

@ -1994,7 +1994,7 @@ class WorkflowStatusItem(XmlSerialisable):
exception=exception)
if expression['type'] == 'template':
vars['allow_complex'] = allow_complex
vars['allow_complex'] = allow_complex and get_publisher().has_site_option('complex-data')
try:
return Template(expression['value'], raises=raises, autoescape=False).render(vars)
except TemplateError as e: