swh.deposit.api.edit module#

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

Bases: APIPut, 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: Request, headers: ParsedRequestHeaders, deposit: Deposit) None[source]#

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

process_put(request, headers: ParsedRequestHeaders, collection_name: str, deposit: 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: Deposit) None[source]#

Delete the container (deposit).

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