workflows: fix attachements xml import on sendmail action (#20319)
This commit is contained in:
parent
c4fc21a21a
commit
69c9fd57d1
|
@ -477,6 +477,22 @@ def test_sendmail_other_destination(pub):
|
|||
assert Role.count() == 0
|
||||
assert wf2.possible_status[0].items[0].to == sendmail.to
|
||||
|
||||
def test_sendmail_attachments(pub):
|
||||
wf = Workflow(name='status')
|
||||
st1 = wf.add_status('Status1', 'st1')
|
||||
|
||||
sendmail = SendmailWorkflowStatusItem()
|
||||
st1.items.append(sendmail)
|
||||
sendmail.parent = st1
|
||||
|
||||
sendmail.attachments = ['form_var_file_raw', 'form_fbo1']
|
||||
wf2 = assert_import_export_works(wf)
|
||||
assert wf2.possible_status[0].items[0].attachments == sendmail.attachments
|
||||
|
||||
sendmail.attachments = []
|
||||
wf2 = assert_import_export_works(wf)
|
||||
assert wf2.possible_status[0].items[0].attachments == []
|
||||
|
||||
def test_sms(pub):
|
||||
wf = Workflow(name='status')
|
||||
st1 = wf.add_status('Status1', 'st1')
|
||||
|
|
|
@ -2054,6 +2054,12 @@ class SendmailWorkflowStatusItem(WorkflowStatusItem):
|
|||
return super(SendmailWorkflowStatusItem, self)._get_role_id_from_xml(
|
||||
elem, charset, include_id=include_id)
|
||||
|
||||
def attachments_init_with_xml(self, elem, charset, include_id=False):
|
||||
if elem is None:
|
||||
self.attachments = None
|
||||
else:
|
||||
self.attachments = [item.text.encode(charset) for item in elem.findall('attachment')]
|
||||
|
||||
def render_list_of_roles_or_emails(self, roles):
|
||||
t = []
|
||||
for r in roles:
|
||||
|
|
Loading…
Reference in New Issue