swh.deposit.api.edit module

class swh.deposit.api.edit.EditAPI[source]

Bases: swh.deposit.api.common.APIPut, swh.deposit.api.common.APIDelete

Deposit request class defining api endpoints for sword deposit.

What’s known as ‘Edit-IRI’ in the sword specification.

HTTP verbs supported: PUT, DELETE

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

parser_classes = (<class 'swh.deposit.parsers.SWHMultiPartParser'>, <class 'swh.deposit.parsers.SWHAtomEntryParser'>)
restrict_access(request: rest_framework.request.Request, headers: swh.deposit.api.common.ParsedRequestHeaders, deposit: swh.deposit.models.Deposit) None[source]

Relax restriction access to allow metadata update on deposit with status “done” when a swhid is provided.

process_put(request, headers: swh.deposit.api.common.ParsedRequestHeaders, collection_name: str, deposit: swh.deposit.models.Deposit) None[source]

This allows the following scenarios:

Raises
  • 400 if any of the following occur

  • - the swhid provided and the deposit swhid do not match

  • - the provided metadata xml file is malformed

  • - the provided xml atom entry is empty

  • - the provided swhid does not exist in the archive

process_delete(req, collection_name: str, deposit: swh.deposit.models.Deposit) None[source]

Delete the container (deposit).

source: http://swordapp.github.io/SWORDv2-Profile/SWORDProfile.html#protocoloperations_deleteconteiner # noqa