Projet

Général

Profil

0003-workflow-allow-empty-base64-content-to-be-exported-a.patch

Nicolas Roche, 27 août 2019 16:57

Télécharger (1,7 ko)

Voir les différences:

Subject: [PATCH 3/4] workflow: allow empty base64 content to be exported as
 xml (#31823)

 tests/test_workflow_import.py | 2 +-
 wcs/wf/export_to_model.py     | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)
tests/test_workflow_import.py
295 295
    export_to.model_file = UploadedFile(pub.APP_DIR, None, upload)
296 296
    st1.items = [export_to]
297 297
    export_to.parent = st1
298
    wf2 = assert_import_export_works(wf)
298
    wf2 = assert_xml_import_export_works(wf)
299 299
    assert wf2.possible_status[0].items[0].model_file.get_file().read() == file_content
300 300

  
301 301
    wf2 = assert_import_export_works(wf, include_id=True)
wcs/wf/export_to_model.py
490 490
        base_filename = elem.find('base_filename').text
491 491
        content_type = elem.find('content_type').text
492 492
        if elem.find('b64_content') is not None:
493
            content = base64.decodestring(elem.find('b64_content').text)
493
            if elem.find('b64_content').text is not None:
494
                content = base64.decodestring(elem.find('b64_content').text)
495
            else:
496
                content = None
494 497
        if elem.find('content') is not None:
495 498
            content = elem.find('content').text
496 499

  
497
-