heliport.pid_registration package

Submodules

heliport.pid_registration.apps module

Django app configuration module for the heliport.pid_registration app.

class heliport.pid_registration.apps.PidRegistrationConfig(app_name, app_module)

Bases: AppConfig

Django app config for the heliport.pid_registration app.

default_auto_field = 'django.db.models.BigAutoField'
name = 'heliport.pid_registration'
ready()

Register hooks and import settings.

heliport.pid_registration.conf module

App settings for the heliport.pid_registration app.

class heliport.pid_registration.conf.HeliportPidRegistrationAppConf(**kwargs)

Bases: AppConf

Settings of the heliport.pid_registration app.

All settings in this class can be overwritten in settings.py

API_URL = 'https://handle.hzdr.de/api/handles'

The API URL of your local Handle.Net server.

CERTIFICATE_PATH = '/etc/ssl/certs/heliport_handle_admin.crt'

The path to the certificate file for authentication.

class Meta

Bases: object

prefix = 'HELIPORT_HANDLE'
PREFIX = '20.500.12865'

The prefix used by your local Handle.Net server.

PRIVATE_KEY_PATH = '/etc/ssl/private/heliport_handle_admin.key'

The path to the private key file for authentication.

REGISTER_HANDLES = False

Enable Handle registration

SERVER_URL = 'https://handle.hzdr.de'

The URL to your local Handle.Net server.

heliport.pid_registration.handle_net module

PID registration interface for handle.net servers.

class heliport.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.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.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.pid_registration.interface module

HELIPORT interface for the PID registration app.

heliport.pid_registration.signal_handlers module

Signal handlers for the app.

heliport.pid_registration.signal_handlers.register_pid_handler(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, and handle registration is enabled, a handle is registered for the digital object.

Currently, only an implementation for Handle.Net PIDs exists. If more implementations are added to the code base, this function may change in order to perform registration with other (and potentially multiple) PID providers.

heliport.pid_registration.tests module

Tests for the heliport.pid_registration app.

class heliport.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.