swh.coarnotify.server.handlers module#

Module dedicated to the handlers of COAR Notifications.

swh.coarnotify.server.handlers.mention(notification: InboundNotification) None[source]#

Handle a mention COAR Notification.

The software identifier sent in object.as:object could be an Origin URL or a SWHID. We need to check if it exists in the storage before saving the Raw Extrinsic Metadata.

For an Origin URL we use storage.origin_get with and without a trailing slash which returns an ExtendedSWHID. For a SWHID we first check it’s valid (it must be a CoreSWHID or QualifiedSWHID) then we convert it to an ExtendedSWHID so we can use it with swhid_is_known.

If these checks fail the mention is rejected.

Otherwise we send the CN with its context to the REM storage and send an Accept CN.

Parameters:

cn – an inbound CN