heliport.core.pid_registration package

Submodules

heliport.core.pid_registration.handle_net module

PID registration interface for handle.net servers.

class heliport.core.pid_registration.handle_net.HandleNetRegistry

Bases: object

Class for PID registration on Handle.Net servers.

full_url(identifier: str) str

Return the full URL for identifier.

identifier is assumed to be valid and containing the server prefix. The URL is simply constructed and returned with no request to the server being sent.

mint_identifier(name: str, target: str) str

Mint an identifier in the Handle registry.

Try to obtain an ID with the name name and make it point to target. Return the ID that was actually minted, including the prefix.

registry_scheme = 'hdl'

A unique name that can be used to refer to this registry and its identifiers throughout HELIPORT. In accordance with N2T and RFC 3651 which use hdl/hdl:, we use hdl as the registry name.

class heliport.core.pid_registration.handle_net.HandleServerSession

Bases: Session

Custom requests.Session subclass for handle server interaction.

request(method, url, **kwargs) Response

Handle request, preventing sending the certificate to the wrong server.

heliport.core.pid_registration.handle_net.register_handle(digital_object: DigitalObject) str | None

Mint a new handle for the given digital object.

The newly minted handle is returned as a full URL, or None if anything goes wrong. If the digital object already has a handle, this handle is returned and no new handle is minted. If the digital object has no primary key (i.e. it was not saved in the database), or no category, None is returned.

The handle is also stored in DigitalObjectIdentifier using the hdl scheme.

heliport.core.pid_registration.heliport_id module

Fallback “PID” registration interface using HELIPORT URLs.

heliport.core.pid_registration.heliport_id.register_heliport_id(digital_object: DigitalObject) str | None

Create a new HELIPORT ID for the given digital object.

heliport.core.pid_registration.signal_handlers module

Signal handlers for the app.

heliport.core.pid_registration.signal_handlers.register_pids(sender, instance: DigitalObject, created: bool, using, update_fields, **kwargs)

Post-save handler for digital object PID registration.

If the saved object was newly created, does not yet have any persistent identifier, persistent identifiers are registered for the digital object.

A “HELIPORT ID” is always registered for the digital object. If handle registration is enabled, a handle is registered for the digital object as well.

heliport.core.pid_registration.tests module

Tests for the heliport.core.pid_registration app.

class heliport.core.pid_registration.tests.HandleNetTest(methodName='runTest')

Bases: TestCase

Tests for handle_net module.

test_handle_server_session()

Disallow request to wrong server.

test_mint_identifier()

Registration of a new handle.

test_register_existing_handle()

Trying to register a handle that already exists.

Module contents

PID registration for digital objects.