From 1b7299db0c8fb14fa4fab39a7dd704a91718d9b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Tue, 28 Jan 2020 09:35:35 +0100 Subject: [PATCH] workflows: fix import of commentable action with custom label (#39316) --- tests/test_workflow_import.py | 4 ++++ wcs/workflows.py | 7 +------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/test_workflow_import.py b/tests/test_workflow_import.py index 27374fee2..f1a09f31a 100644 --- a/tests/test_workflow_import.py +++ b/tests/test_workflow_import.py @@ -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') diff --git a/wcs/workflows.py b/wcs/workflows.py index 4cee17d62..ad537a2e7 100644 --- a/wcs/workflows.py +++ b/wcs/workflows.py @@ -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: