Page MenuHomeSoftware Heritage

D4065.id14368.diff
No OneTemporary

D4065.id14368.diff

diff --git a/swh/deposit/parsers.py b/swh/deposit/parsers.py
--- a/swh/deposit/parsers.py
+++ b/swh/deposit/parsers.py
@@ -46,7 +46,16 @@
"""
parser_context = parser_context or {}
encoding = parser_context.get("encoding", settings.DEFAULT_CHARSET)
- data = xmltodict.parse(stream, encoding=encoding, process_namespaces=False)
+ namespaces = {
+ "http://www.w3.org/2005/Atom": None,
+ "http://purl.org/dc/terms/": None,
+ "https://doi.org/10.5063/SCHEMA/CODEMETA-2.0": "codemeta",
+ "http://purl.org/net/sword/": "sword",
+ }
+
+ data = xmltodict.parse(
+ stream, encoding=encoding, namespaces=namespaces, process_namespaces=True
+ )
if "entry" in data:
data = data["entry"]
return data
diff --git a/swh/deposit/tests/api/test_deposit_private_read_metadata.py b/swh/deposit/tests/api/test_deposit_private_read_metadata.py
--- a/swh/deposit/tests/api/test_deposit_private_read_metadata.py
+++ b/swh/deposit/tests/api/test_deposit_private_read_metadata.py
@@ -69,7 +69,6 @@
},
"origin_metadata": {
"metadata": {
- "@xmlns": ["http://www.w3.org/2005/Atom"],
"author": ["some awesome author", "another one", "no one"],
"codemeta:dateCreated": "2017-10-07T15:17:08Z",
"external_identifier": "some-external-id",
@@ -145,7 +144,6 @@
},
"origin_metadata": {
"metadata": {
- "@xmlns": ["http://www.w3.org/2005/Atom"],
"author": ["some awesome author", "another one", "no one"],
"codemeta:dateCreated": "2017-10-07T15:17:08Z",
"external_identifier": "some-external-id",
@@ -218,8 +216,6 @@
data = response.json()
metadata = {
- "@xmlns": ["http://www.w3.org/2005/Atom"],
- "@xmlns:codemeta": "https://doi.org/10.5063/SCHEMA/CODEMETA-2.0",
"author": [
"some awesome author",
"another one",
@@ -322,8 +318,6 @@
data = response.json()
metadata = {
- "@xmlns": "http://www.w3.org/2005/Atom",
- "@xmlns:codemeta": "https://doi.org/10.5063/SCHEMA/CODEMETA-2.0",
"author": {"email": "hal@ccsd.cnrs.fr", "name": "HAL"},
"client": "hal",
"codemeta:applicationCategory": "test",
@@ -445,8 +439,6 @@
}
metadata = {
- "@xmlns": "http://www.w3.org/2005/Atom",
- "@xmlns:codemeta": "https://doi.org/10.5063/SCHEMA/CODEMETA-2.0",
"author": {"email": "hal@ccsd.cnrs.fr", "name": "HAL"},
"client": "hal",
"codemeta:applicationCategory": "test",
diff --git a/swh/deposit/tests/api/test_parser.py b/swh/deposit/tests/api/test_parser.py
--- a/swh/deposit/tests/api/test_parser.py
+++ b/swh/deposit/tests/api/test_parser.py
@@ -32,8 +32,6 @@
actual_result = SWHXMLParser().parse(xml_no_duplicate)
expected_dict = OrderedDict(
[
- ("@xmlns", "http://www.w3.org/2005/Atom"),
- ("@xmlns:codemeta", "https://doi.org/10.5063/SCHEMA/CODEMETA-2.0"),
("title", "Awesome Compiler"),
(
"codemeta:license",
@@ -92,8 +90,6 @@
expected_dict = OrderedDict(
[
- ("@xmlns", "http://www.w3.org/2005/Atom"),
- ("@xmlns:codemeta", "https://doi.org/10.5063/SCHEMA/CODEMETA-2.0"),
("title", "Another Compiler"),
("codemeta:runtimePlatform", ["GNU/Linux", "Un*x"]),
(
diff --git a/swh/deposit/tests/data/atom/entry-data3.xml b/swh/deposit/tests/data/atom/entry-data3.xml
--- a/swh/deposit/tests/data/atom/entry-data3.xml
+++ b/swh/deposit/tests/data/atom/entry-data3.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<entry xmlns="http://www.w3.org/2005/Atom">
+<entry xmlns="http://www.w3.org/2005/Atom" xmlns:codemeta="https://doi.org/10.5063/SCHEMA/CODEMETA-2.0">
<author>another one</author>
<author>no one</author>
<codemeta:dateCreated>2017-10-07T15:17:08Z</codemeta:dateCreated>

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 17, 11:45 AM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3223499

Event Timeline