tardis.apps.oaipmh.provider package

Submodules

tardis.apps.oaipmh.provider.base module

class tardis.apps.oaipmh.provider.base.BaseProvider(site)

Bases: oaipmh.interfaces.IOAI, object

A base provider which roughly implements the PyOAI interface for OAI-PMH servers.

Extend this if you’re writing your own provider for a new type or a different metadata format.

getRecord(metadataPrefix, identifier)

Get a record for a metadataPrefix and identifier.

Parameters:
  • metadataPrefix (string) – identifies metadata set to retrieve
  • identifier (string) –
    • repository-unique identifier of record
Raises:
  • oaipmh.error.CannotDisseminateFormatError – if metadataPrefix is unknown or not supported by identifier.
  • oaipmh.error.IdDoesNotExistError – if identifier is unknown or illegal.
Returns:

a header, metadata, about tuple describing the record.

identify()
listIdentifiers(metadataPrefix, set=None, from_=None, until=None)

Get a list of header information on records.

Parameters:
  • metadataPrefix (string) – identifies metadata set to retrieve
  • set (string) – set identifier; only return headers in set
  • from (datetime) – only retrieve headers from from_ date forward (in naive UTC)
  • until (datetime) – only retrieve headers with dates up to and including until date (in naive UTC)
Raises:
  • error.CannotDisseminateFormatError – if metadataPrefix is not supported by the repository.
  • error.NoSetHierarchyError – if the repository does not support sets.
Returns:

an iterable of headers.

listMetadataFormats(identifier=None)

List metadata formats supported by repository or record.

Parameters:

identifier (string) – identify record for which we want to know all supported metadata formats. If absent, list all metadata formats supported by repository.

Raises:
  • error.IdDoesNotExistError – if record with identifier does not exist.
  • error.NoMetadataFormatsError – if no formats are available for the indicated record.
Returns:

an iterable of metadataPrefix, schema, metadataNamespace tuples (each entry in the tuple is a string).

listRecords(metadataPrefix, set=None, from_=None, until=None)

Get a list of header, metadata and about information on records.

Parameters:
  • metadataPrefix (string) – identifies metadata set to retrieve
  • set (string) – set identifier; only return records in set
  • from (datetime) – only retrieve records from from_ date forward (in naive UTC)
  • until (datetime) – only retrieve records with dates up to and including until date (in naive UTC)
Raises:
  • oaipmh.error.CannotDisseminateFormatError – if metadataPrefix is not supported by the repository.
  • oaipmh.error.NoSetHierarchyError – if the repository does not support sets.
Returns:

an iterable of header, metadata, about tuples.

listSets()

Get a list of sets in the repository.

Raises:error.NoSetHierarchyError – if the repository does not support sets.
Returns:an iterable of setSpec, setName tuples (strings).
writeMetadata(element, metadata)

Create XML elements under the given element, using the provided metadata.

Should avoid doing any model-lookups, as they should be done when creating the metadata.

Parameters:
  • element (lxml.etree.Element) – element to put all content under (as SubElements)
  • metadata (oaipmh.common.Metadata) – metadata to turn into XML

tardis.apps.oaipmh.provider.experiment module

Module contents