backoffice: do not include python test tools if python is forbidden (#76103)

This commit is contained in:
Frédéric Péters 2023-04-01 11:29:17 +02:00
parent 6d11417ae3
commit 258689082b
1 changed files with 7 additions and 2 deletions

View File

@ -3462,7 +3462,9 @@ class FormBackOfficeStatusPage(FormStatusPage):
('template', '%s / %s' % (_('Template'), _('Django Expression')), 'template'),
('html_template', _('HTML Template (WYSIWYG)'), 'html_template'),
]
if get_publisher().has_site_option('disable-python-expressions'):
if get_publisher().has_site_option('disable-python-expressions') or get_publisher().has_site_option(
'forbid-python-expressions'
):
options = [x for x in options if x[0] != 'python-condition']
form.add(
RadiobuttonsWidget,
@ -3481,7 +3483,10 @@ class FormBackOfficeStatusPage(FormStatusPage):
'data-dynamic-display-value': 'django-condition',
},
)
if not get_publisher().has_site_option('disable-python-expressions'):
if not (
get_publisher().has_site_option('disable-python-expressions')
or get_publisher().has_site_option('forbid-python-expressions')
):
form.add(
StringWidget,
'python-condition',