Page MenuHomeSoftware Heritage

deposit.parsers: Process namespace when using xmltodict.parse
ClosedPublic

Authored by ardumont on Sep 28 2020, 4:13 PM.

Details

Summary

This keeps the existing behavior though by mapping the expanded namespace (full url in keys)
to simpler namespaces (again as it is currently).

This also fixes some test data sample which were not properly defining their
namespace (and which now expectedly failed).

This will allow to deal properly with all empty body cases (only 1 so far). D4067 fixes that.

Test Plan

tox

Diff Detail

Repository
rDDEP Push deposit
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 15653
Build 24099: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 24098: arc lint + arc unit

Event Timeline

Build is green

Patch application report for D4065 (id=14357)

Could not rebase; Attempt merge onto 87b39c10ee...

Updating 87b39c10..d86c1922
Fast-forward
 swh/deposit/api/checks.py                                   |  2 ++
 swh/deposit/parsers.py                                      | 11 ++++++++++-
 swh/deposit/tests/api/test_deposit_private_read_metadata.py |  8 --------
 swh/deposit/tests/api/test_parser.py                        |  4 ----
 swh/deposit/tests/data/atom/entry-data3.xml                 |  2 +-
 5 files changed, 13 insertions(+), 14 deletions(-)
Changes applied before test
commit d86c192234a025a027202379789e074441dadbc3
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Sep 28 16:09:59 2020 +0200

    deposit.parsers: Process namespace when using xmltodict.parse
    
    This keeps the existing behavior though by mapping the expanded name to simpler
    namespaces.
    
    This also fixes some test data sample which were not properly defining their
    namespace.
    
    This will allow to deal more properly the empty body case which is incomplete
    right now.

commit cc8d12524845811345735a00e836f29dea8fac8c
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Sep 28 14:15:48 2020 +0200

    deposit.api.checks: Add docstring to module

See https://jenkins.softwareheritage.org/job/DDEP/job/tests-on-diff/154/ for more details.

nice!

Can you also remove the xmlns declaration in the "empty" XML data file?

This revision is now accepted and ready to land.Sep 28 2020, 5:34 PM

Build is green

Patch application report for D4065 (id=14362)

Rebasing onto 87b39c10ee...

Current branch diff-target is up to date.
Changes applied before test
commit f05480888a317c5cbc181ebdaa8d98e58914cc06
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Mon Sep 28 16:09:59 2020 +0200

    deposit.parsers: Process namespace when using xmltodict.parse
    
    This keeps the existing behavior though by mapping the expanded name to simpler
    namespaces.
    
    This also fixes some test data sample which were not properly defining their
    namespace.
    
    This will allow to deal more properly the empty body case which is incomplete
    right now.

See https://jenkins.softwareheritage.org/job/DDEP/job/tests-on-diff/157/ for more details.