Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/parsers.py
# Copyright (C) 2017-2019 The Software Heritage developers | # Copyright (C) 2017-2020 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
"""Module in charge of defining parsers with SWORD 2.0 supported mediatypes. | """Module in charge of defining parsers with SWORD 2.0 supported mediatypes. | ||||
""" | """ | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | class SWHAtomEntryParser(SWHXMLParser): | ||||
""" | """ | ||||
media_type = "application/atom+xml;type=entry" | media_type = "application/atom+xml;type=entry" | ||||
def parse(self, stream, media_type=None, parser_context=None): | def parse(self, stream, media_type=None, parser_context=None): | ||||
# We do not actually want to parse the stream yet | # We do not actually want to parse the stream yet | ||||
# because we want to keep the raw data as well | # because we want to keep the raw data as well | ||||
# this is done later in the atom entry call | # this is done later in the atom entry call | ||||
# (cf. swh.deposit.api.common.SWHBaseDeposit._atom_entry) | # (cf. swh.deposit.api.common.APIBase._atom_entry) | ||||
return stream | return stream | ||||
class SWHMultiPartParser(MultiPartParser): | class SWHMultiPartParser(MultiPartParser): | ||||
"""Multipart parser limited to a subset of mediatypes. | """Multipart parser limited to a subset of mediatypes. | ||||
""" | """ | ||||
Show All 20 Lines |