From 0c4ab5e99286b3b9474816137747ba11568571d8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= <fpeters@entrouvert.com>
Date: Fri, 5 Mar 2021 12:09:38 +0100
Subject: [PATCH] workflows: don't run custom form validation code in
 VariablesWidget (#51657)

---
 tests/admin_pages/test_workflow.py | 26 ++++++++++++++++
 wcs/admin/workflows.py             |  2 +-
 wcs/qommon/sessions.py             |  1 +
 wcs/wf/aggregation_email.py        |  6 ++--
 wcs/wf/attachment.py               |  6 ++--
 wcs/wf/backoffice_fields.py        |  6 ++--
 wcs/wf/create_formdata.py          | 10 +++---
 wcs/wf/criticality.py              |  6 ++--
 wcs/wf/dispatch.py                 |  6 ++--
 wcs/wf/export_to_model.py          |  4 +--
 wcs/wf/external_workflow.py        |  7 +++--
 wcs/wf/form.py                     |  6 ++--
 wcs/wf/geolocate.py                |  6 ++--
 wcs/wf/jump.py                     |  4 +--
 wcs/wf/notification.py             |  6 ++--
 wcs/wf/profile.py                  |  6 ++--
 wcs/wf/redirect_to_url.py          |  6 ++--
 wcs/wf/register_comment.py         |  6 ++--
 wcs/wf/resubmit.py                 |  6 ++--
 wcs/wf/roles.py                    | 12 +++----
 wcs/wf/wscall.py                   |  6 ++--
 wcs/workflows.py                   | 50 ++++++++++--------------------
 22 files changed, 92 insertions(+), 102 deletions(-)

diff --git a/tests/admin_pages/test_workflow.py b/tests/admin_pages/test_workflow.py
index 45eb8d8c3..a41579305 100644
--- a/tests/admin_pages/test_workflow.py
+++ b/tests/admin_pages/test_workflow.py
@@ -1277,6 +1277,32 @@ def test_workflows_variables_edit(pub):
     assert Workflow.get(1).variables_formdef.fields[0].varname == '1*1*message'
 
 
+def test_workflows_variables_edit_with_all_action_types(pub):
+    test_workflows_add_all_actions(pub)
+
+    app = login(get_app(pub))
+    resp = app.get('/backoffice/workflows/1/')
+    resp = resp.click(href='variables/')
+    assert resp.location == 'http://example.net/backoffice/workflows/1/variables/fields/'
+    resp = resp.follow()
+
+    # add a simple field
+    resp.forms[0]['label'] = 'foobar'
+    resp.forms[0]['type'] = 'string'
+    resp = resp.forms[0].submit()
+    assert resp.location == 'http://example.net/backoffice/workflows/1/variables/fields/'
+    resp = resp.follow()
+
+    resp = app.get('/backoffice/workflows/1/variables/fields/')
+    resp = resp.click('Edit', href='1/')
+    assert 'varname$select' in resp.forms[0].fields
+    resp.forms[0]['varname$name'].value = 'xxx'
+    resp = resp.forms[0].submit('submit')
+
+    assert Workflow.get(1).variables_formdef.fields[0].key == 'string'
+    assert Workflow.get(1).variables_formdef.fields[0].varname == 'xxx'
+
+
 def test_workflows_variables_with_export_to_model_action(pub):
     test_workflows_variables(pub)
 
diff --git a/wcs/admin/workflows.py b/wcs/admin/workflows.py
index fc835b714..0aa695d35 100644
--- a/wcs/admin/workflows.py
+++ b/wcs/admin/workflows.py
@@ -941,7 +941,7 @@ class WorkflowVariableWidget(CompositeWidget):
                     for parameter in parameters:
                         key = prefix + parameter
                         fake_form = Form()
-                        item.add_parameters_widgets(fake_form, [parameter])
+                        item.add_parameters_widgets(fake_form, [parameter], orig='variable_widget')
                         if not fake_form.widgets:
                             continue
                         parameter_label = fake_form.widgets[0].title
diff --git a/wcs/qommon/sessions.py b/wcs/qommon/sessions.py
index 477e9af1c..7fd0b8c30 100644
--- a/wcs/qommon/sessions.py
+++ b/wcs/qommon/sessions.py
@@ -175,6 +175,7 @@ class Session(QommonSession, CaptchaSession, StorableObject):
 
     def create_form_token(self):
         token = super(Session, self).create_form_token()
+        print('created token:', token)
         open(self.get_form_token_filepath(token), 'wb').close()
         return token
 
diff --git a/wcs/wf/aggregation_email.py b/wcs/wf/aggregation_email.py
index e1bfc3a60..5a23a610d 100644
--- a/wcs/wf/aggregation_email.py
+++ b/wcs/wf/aggregation_email.py
@@ -39,10 +39,8 @@ class AggregationEmailWorkflowStatusItem(WorkflowStatusItem):
         else:
             return _('not completed')
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
-        super(AggregationEmailWorkflowStatusItem, self).add_parameters_widgets(
-            form, parameters, prefix=prefix, formdef=formdef
-        )
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
+        super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef, **kwargs)
         if 'to' in parameters:
             form.add(
                 WidgetList,
diff --git a/wcs/wf/attachment.py b/wcs/wf/attachment.py
index fc5d5c886..52e4a64e9 100644
--- a/wcs/wf/attachment.py
+++ b/wcs/wf/attachment.py
@@ -178,10 +178,8 @@ class AddAttachmentWorkflowStatusItem(WorkflowStatusItem):
         parameters += ('condition',)
         return parameters
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
-        super(AddAttachmentWorkflowStatusItem, self).add_parameters_widgets(
-            form, parameters, prefix=prefix, formdef=formdef
-        )
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
+        super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef, **kwargs)
         if 'by' in parameters:
             form.add(
                 WidgetList,
diff --git a/wcs/wf/backoffice_fields.py b/wcs/wf/backoffice_fields.py
index 03230a261..b6bd8bb14 100644
--- a/wcs/wf/backoffice_fields.py
+++ b/wcs/wf/backoffice_fields.py
@@ -102,10 +102,8 @@ class SetBackofficeFieldsWorkflowStatusItem(WorkflowStatusItem):
     def get_parameters(self):
         return ('label', 'fields', 'condition')
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
-        super(SetBackofficeFieldsWorkflowStatusItem, self).add_parameters_widgets(
-            form, parameters, prefix=prefix, formdef=formdef
-        )
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
+        super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef, **kwargs)
         if 'label' in parameters:
             form.add(StringWidget, '%slabel' % prefix, size=40, title=_('Label'), value=self.label)
 
diff --git a/wcs/wf/create_formdata.py b/wcs/wf/create_formdata.py
index cc4c95a2a..f9231c64e 100644
--- a/wcs/wf/create_formdata.py
+++ b/wcs/wf/create_formdata.py
@@ -240,10 +240,8 @@ class CreateFormdataWorkflowStatusItem(WorkflowStatusItem):
     def formdef(self):
         return self._resolve_formdef_slug(self.formdef_slug)
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
-        super(CreateFormdataWorkflowStatusItem, self).add_parameters_widgets(
-            form, parameters, prefix=prefix, formdef=formdef
-        )
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
+        super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef, **kwargs)
         if 'formdef_slug' in parameters:
             list_forms = [(None, '---', '')]
             list_forms += [
@@ -338,6 +336,10 @@ class CreateFormdataWorkflowStatusItem(WorkflowStatusItem):
                 title=_('Include new form in the form history'),
                 value=self.attach_to_history,
             )
+
+        if kwargs.get('orig') == 'variable_widget':
+            return
+
         errors = [w.name for w in form.get_all_widgets() if w.has_error()]
         if set(errors) == set(['%smappings' % prefix]):
             form.ERROR_NOTICE = _('This action is configured in two steps. See below for details.')
diff --git a/wcs/wf/criticality.py b/wcs/wf/criticality.py
index f87f5fdfd..342997ec2 100644
--- a/wcs/wf/criticality.py
+++ b/wcs/wf/criticality.py
@@ -38,10 +38,8 @@ class ModifyCriticalityWorkflowStatusItem(WorkflowStatusItem):
     def is_available(cls, workflow=None):
         return workflow and workflow.criticality_levels
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
-        super(ModifyCriticalityWorkflowStatusItem, self).add_parameters_widgets(
-            form, parameters, prefix=prefix, formdef=formdef
-        )
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
+        super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef, **kwargs)
         if 'mode' in parameters:
             form.add(
                 SingleSelectWidget,
diff --git a/wcs/wf/dispatch.py b/wcs/wf/dispatch.py
index 4dd479fee..6b6952fd5 100644
--- a/wcs/wf/dispatch.py
+++ b/wcs/wf/dispatch.py
@@ -123,10 +123,8 @@ class DispatchWorkflowStatusItem(WorkflowStatusItem):
             return function_label
         return None
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
-        super(DispatchWorkflowStatusItem, self).add_parameters_widgets(
-            form, parameters, prefix=prefix, formdef=formdef
-        )
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
+        super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef, **kwargs)
         if 'role_key' in parameters:
             if not self.parent.parent.roles:
                 self.parent.parent.roles = {}
diff --git a/wcs/wf/export_to_model.py b/wcs/wf/export_to_model.py
index 8dedce57a..e403e102e 100644
--- a/wcs/wf/export_to_model.py
+++ b/wcs/wf/export_to_model.py
@@ -317,8 +317,8 @@ class ExportToModel(WorkflowStatusItem):
         parameters += ('method', 'by', 'label', 'backoffice_info_text', 'filename', 'condition')
         return parameters
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
-        super(ExportToModel, self).add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef)
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
+        super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef, **kwargs)
         methods = collections.OrderedDict(
             [('interactive', _('Interactive (button)')), ('non-interactive', _('Non interactive'))]
         )
diff --git a/wcs/wf/external_workflow.py b/wcs/wf/external_workflow.py
index c830c3367..09c5e6290 100644
--- a/wcs/wf/external_workflow.py
+++ b/wcs/wf/external_workflow.py
@@ -72,8 +72,8 @@ class ExternalWorkflowGlobalAction(WorkflowStatusItem):
             if trigger.identifier == trigger_id:
                 return trigger
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
-        super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef)
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
+        super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef, **kwargs)
 
         if 'slug' in parameters:
             objects = [(None, '---', '')]
@@ -139,6 +139,9 @@ class ExternalWorkflowGlobalAction(WorkflowStatusItem):
                 options=triggers_names,
             )
 
+        if kwargs.get('orig') == 'variable_widget':
+            return
+
         errors = [w.name for w in form.get_all_widgets() if w.has_error()]
         if set(errors) == set(['%strigger_id' % prefix]):
             form.ERROR_NOTICE = _('This action is configured in two steps. See below for details.')
diff --git a/wcs/wf/form.py b/wcs/wf/form.py
index b4a1534a0..8ce7daabc 100644
--- a/wcs/wf/form.py
+++ b/wcs/wf/form.py
@@ -103,10 +103,8 @@ class FormWorkflowStatusItem(WorkflowStatusItem):
             FileDirectory._lookup_methods.append('lookup_wf_form_file')
             FileDirectory.lookup_wf_form_file = lookup_wf_form_file
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
-        super(FormWorkflowStatusItem, self).add_parameters_widgets(
-            form, parameters, prefix=prefix, formdef=formdef
-        )
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
+        super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef, **kwargs)
         if 'by' in parameters:
             form.add(
                 WidgetList,
diff --git a/wcs/wf/geolocate.py b/wcs/wf/geolocate.py
index 9e1283980..90d7bc93a 100644
--- a/wcs/wf/geolocate.py
+++ b/wcs/wf/geolocate.py
@@ -49,10 +49,8 @@ class GeolocateWorkflowStatusItem(WorkflowStatusItem):
     def get_parameters(self):
         return ('method', 'address_string', 'map_variable', 'photo_variable', 'overwrite', 'condition')
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
-        super(GeolocateWorkflowStatusItem, self).add_parameters_widgets(
-            form, parameters, prefix=prefix, formdef=formdef
-        )
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
+        super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef, **kwargs)
         methods = collections.OrderedDict(
             [
                 ('address_string', _('Address String')),
diff --git a/wcs/wf/jump.py b/wcs/wf/jump.py
index d0912bba4..5e66ff034 100644
--- a/wcs/wf/jump.py
+++ b/wcs/wf/jump.py
@@ -176,8 +176,8 @@ class JumpWorkflowStatusItem(WorkflowStatusJumpItem):
             return ('status', 'condition', 'by', 'timeout', 'set_marker_on_status')
         return ('status', 'condition', 'trigger', 'by', 'timeout', 'set_marker_on_status')
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
-        super(JumpWorkflowStatusItem, self).add_parameters_widgets(form, parameters, prefix, formdef)
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
+        super().add_parameters_widgets(form, parameters, prefix, formdef, **kwargs)
         if 'condition' in parameters:
             form.get_widget('%scondition' % prefix).advanced = False
         if 'trigger' in parameters:
diff --git a/wcs/wf/notification.py b/wcs/wf/notification.py
index a860803f0..b9a914af3 100644
--- a/wcs/wf/notification.py
+++ b/wcs/wf/notification.py
@@ -72,7 +72,7 @@ class SendNotificationWorkflowStatusItem(WebserviceCallStatusItem):
     def get_parameters(self):
         return ('title', 'body', 'origin', 'condition')
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
         if 'to' in parameters:
             # never displayed in the current UI (no 'to' in get_parameters)
             form.add(
@@ -115,7 +115,9 @@ class SendNotificationWorkflowStatusItem(WebserviceCallStatusItem):
                 required=False,
                 advanced=not (self.origin),
             )
-        WorkflowStatusItem.add_parameters_widgets(self, form, parameters, prefix=prefix, formdef=formdef)
+        WorkflowStatusItem.add_parameters_widgets(
+            self, form, parameters, prefix=prefix, formdef=formdef, **kwargs
+        )
 
     def perform(self, formdata):
         if not (self.is_available() and self.to and self.title and self.body):
diff --git a/wcs/wf/profile.py b/wcs/wf/profile.py
index 35a5e38f8..ef5da882f 100644
--- a/wcs/wf/profile.py
+++ b/wcs/wf/profile.py
@@ -110,10 +110,8 @@ class UpdateUserProfileStatusItem(WorkflowStatusItem):
     def get_parameters(self):
         return ('fields', 'condition')
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
-        super(UpdateUserProfileStatusItem, self).add_parameters_widgets(
-            form, parameters, prefix=prefix, formdef=formdef
-        )
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
+        super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef, **kwargs)
         if 'fields' in parameters:
             form.add(
                 ProfileUpdateTableWidget, '%sfields' % prefix, title=_('Profile Update'), value=self.fields
diff --git a/wcs/wf/redirect_to_url.py b/wcs/wf/redirect_to_url.py
index e023ea25e..3ce7e727d 100644
--- a/wcs/wf/redirect_to_url.py
+++ b/wcs/wf/redirect_to_url.py
@@ -37,10 +37,8 @@ class RedirectToUrlWorkflowStatusItem(WorkflowStatusItem):
     def get_parameters(self):
         return ('url', 'condition')
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
-        super(RedirectToUrlWorkflowStatusItem, self).add_parameters_widgets(
-            form, parameters, prefix=prefix, formdef=formdef
-        )
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
+        super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef, **kwargs)
         if 'url' in parameters:
             widget = form.add(
                 ComputedExpressionWidget,
diff --git a/wcs/wf/register_comment.py b/wcs/wf/register_comment.py
index 8aea5f723..2458dd5b2 100644
--- a/wcs/wf/register_comment.py
+++ b/wcs/wf/register_comment.py
@@ -86,10 +86,8 @@ class RegisterCommenterWorkflowStatusItem(WorkflowStatusItem):
     to = None
     attachments = None
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
-        super(RegisterCommenterWorkflowStatusItem, self).add_parameters_widgets(
-            form, parameters, prefix=prefix, formdef=formdef
-        )
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
+        super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef, **kwargs)
         if 'comment' in parameters:
             form.add(
                 TextWidget, '%scomment' % prefix, title=_('Message'), value=self.comment, cols=80, rows=10
diff --git a/wcs/wf/resubmit.py b/wcs/wf/resubmit.py
index d001b3372..875ae7738 100644
--- a/wcs/wf/resubmit.py
+++ b/wcs/wf/resubmit.py
@@ -118,10 +118,8 @@ class ResubmitWorkflowStatusItem(WorkflowStatusItem):
         if formdata.user_id is None and not new_formdata.backoffice_submission:
             get_session().mark_anonymous_formdata(new_formdata)
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
-        super(ResubmitWorkflowStatusItem, self).add_parameters_widgets(
-            form, parameters, prefix=prefix, formdef=formdef
-        )
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
+        super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef, **kwargs)
         if 'by' in parameters:
             form.add(
                 WidgetList,
diff --git a/wcs/wf/roles.py b/wcs/wf/roles.py
index ec984a139..c16d0467a 100644
--- a/wcs/wf/roles.py
+++ b/wcs/wf/roles.py
@@ -55,10 +55,8 @@ class AddRoleWorkflowStatusItem(WorkflowStatusItem):
     def get_parameters(self):
         return ('role_id', 'condition')
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
-        super(AddRoleWorkflowStatusItem, self).add_parameters_widgets(
-            form, parameters, prefix=prefix, formdef=formdef
-        )
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
+        super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef, **kwargs)
         if 'role_id' in parameters:
             form.add(
                 SingleSelectWidgetWithOther,
@@ -135,10 +133,8 @@ class RemoveRoleWorkflowStatusItem(WorkflowStatusItem):
     def get_parameters(self):
         return ('role_id', 'condition')
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
-        super(RemoveRoleWorkflowStatusItem, self).add_parameters_widgets(
-            form, parameters, prefix=prefix, formdef=formdef
-        )
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
+        super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef, **kwargs)
         if 'role_id' in parameters:
             form.add(
                 SingleSelectWidgetWithOther,
diff --git a/wcs/wf/wscall.py b/wcs/wf/wscall.py
index 11c04e681..cc64ae264 100644
--- a/wcs/wf/wscall.py
+++ b/wcs/wf/wscall.py
@@ -179,10 +179,8 @@ class WebserviceCallStatusItem(WorkflowStatusItem):
             'condition',
         )
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
-        super(WebserviceCallStatusItem, self).add_parameters_widgets(
-            form, parameters, prefix=prefix, formdef=formdef
-        )
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
+        super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef, **kwargs)
         if 'label' in parameters:
             form.add(StringWidget, '%slabel' % prefix, size=40, title=_('Label'), value=self.label)
 
diff --git a/wcs/workflows.py b/wcs/workflows.py
index beb867281..9d95bf6d8 100644
--- a/wcs/workflows.py
+++ b/wcs/workflows.py
@@ -1936,7 +1936,7 @@ class WorkflowStatusItem(XmlSerialisable):
         except RuntimeError:
             return False
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
         if 'condition' in parameters:
             form.add(
                 ConditionWidget,
@@ -2339,10 +2339,8 @@ class WorkflowStatusJumpItem(WorkflowStatusItem):
     set_marker_on_status = False
     category = 'status-change'
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
-        super(WorkflowStatusJumpItem, self).add_parameters_widgets(
-            form, parameters, prefix=prefix, formdef=formdef
-        )
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
+        super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef, **kwargs)
         if 'status' in parameters:
             destinations = [(x.id, x.name) for x in self.parent.parent.possible_status]
 
@@ -2499,10 +2497,8 @@ class CommentableWorkflowStatusItem(WorkflowStatusItem):
             'condition',
         )
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
-        super(CommentableWorkflowStatusItem, self).add_parameters_widgets(
-            form, parameters, prefix=prefix, formdef=formdef
-        )
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
+        super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef, **kwargs)
         if 'label' in parameters:
             if self.label is None:
                 self.label = _('Comment')
@@ -2646,10 +2642,8 @@ class ChoiceWorkflowStatusItem(WorkflowStatusJumpItem):
                 form.clear_errors()
                 return True  # get out of processing loop
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
-        super(ChoiceWorkflowStatusItem, self).add_parameters_widgets(
-            form, parameters, prefix=prefix, formdef=formdef
-        )
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
+        super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef, **kwargs)
         if 'label' in parameters:
             form.add(ComputedExpressionWidget, '%slabel' % prefix, title=_('Label'), value=self.label)
         if 'by' in parameters:
@@ -2795,10 +2789,8 @@ class SendmailWorkflowStatusItem(WorkflowStatusItem):
     def get_parameters(self):
         return ('to', 'mail_template', 'subject', 'body', 'attachments', 'custom_from', 'condition')
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
-        super(SendmailWorkflowStatusItem, self).add_parameters_widgets(
-            form, parameters, prefix=prefix, formdef=formdef
-        )
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
+        super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef, **kwargs)
         subject_body_attrs = {}
         if 'subject' in parameters or 'body' in parameters:
             if get_publisher().has_site_option('mail-templates') and MailTemplate.count():
@@ -3054,10 +3046,8 @@ class SendSMSWorkflowStatusItem(WorkflowStatusItem):
     def get_parameters(self):
         return ('to', 'body', 'condition')
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
-        super(SendSMSWorkflowStatusItem, self).add_parameters_widgets(
-            form, parameters, prefix=prefix, formdef=formdef
-        )
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
+        super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef, **kwargs)
         if 'to' in parameters:
             form.add(
                 WidgetList,
@@ -3147,10 +3137,8 @@ class DisplayMessageWorkflowStatusItem(WorkflowStatusItem):
 
         return Template(message, ezt_format=ezt.FORMAT_HTML).render(dict)
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
-        super(DisplayMessageWorkflowStatusItem, self).add_parameters_widgets(
-            form, parameters, prefix=prefix, formdef=formdef
-        )
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
+        super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef, **kwargs)
         if 'message' in parameters:
             form.add(
                 TextWidget,
@@ -3223,10 +3211,8 @@ class RedirectToStatusWorkflowStatusItem(WorkflowStatusItem):
     def perform(self, formdata):
         return formdata.get_url(self.backoffice)
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
-        super(RedirectToStatusWorkflowStatusItem, self).add_parameters_widgets(
-            form, parameters, prefix=prefix, formdef=formdef
-        )
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
+        super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef, **kwargs)
         if 'backoffice' in parameters:
             form.add(
                 CheckboxWidget,
@@ -3273,10 +3259,8 @@ class EditableWorkflowStatusItem(WorkflowStatusItem):
         if form.get_submit() == 'button%s' % self.id:
             return formdata.get_url(backoffice=get_request().is_in_backoffice()) + 'wfedit-%s' % self.id
 
-    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None):
-        super(EditableWorkflowStatusItem, self).add_parameters_widgets(
-            form, parameters, prefix=prefix, formdef=formdef
-        )
+    def add_parameters_widgets(self, form, parameters, prefix='', formdef=None, **kwargs):
+        super().add_parameters_widgets(form, parameters, prefix=prefix, formdef=formdef, **kwargs)
         if 'by' in parameters:
             form.add(
                 WidgetList,
-- 
2.30.1

