workflows: fix import of commentable action with custom label (#39316)

This commit is contained in:
Frédéric Péters 2020-01-28 09:35:35 +01:00
parent c2c1fcdf50
commit 1b7299db0c
2 changed files with 5 additions and 6 deletions

View File

@ -381,6 +381,10 @@ def test_commentable_action(pub):
wf2 = Workflow.import_from_xml_tree(ET.parse(BytesIO(xml_export)))
assert wf2.possible_status[0].items[0].required is False
commentable.button_label = 'button label'
wf2 = assert_import_export_works(wf)
assert wf2.possible_status[0].items[0].button_label == 'button label'
def test_variables_formdef(pub):
wf = Workflow(name='variables')

View File

@ -2293,12 +2293,7 @@ class CommentableWorkflowStatusItem(WorkflowStatusItem):
el = ET.SubElement(xml_item, 'button_label')
else:
el = ET.SubElement(xml_item, 'button_label')
if type(self.button_label) is unicode:
el.text = self.button_label
elif type(self.button_label) is str:
el.text = force_text(self.button_label, charset, errors='replace')
else:
raise AssertionError('unknown type for button_label (%r)' % self.button_label)
el.text = self.button_label
def button_label_init_with_xml(self, element, charset, include_id=False):
if element is None: