deposit.models module

class deposit.models.DepositRecord(*args, **kwargs)[source]

Bases: django.db.models.base.Model

This model stores the results of a deposit initiated by the user, regardless of its success. Protocol implementers should not have to deal with this model directly, their interfaces should only manipulate DepositResult objects and DepositError exceptions, depending on the success of the deposit.

Parameters:
  • id (AutoField) – Id
  • paper_id (ForeignKey) – Paper
  • user_id (ForeignKey) – User
  • repository_id (ForeignKey) – Repository
  • request (TextField) – Request
  • identifier (CharField) – Identifier
  • oairecord_id (ForeignKey) – Oairecord
  • date (DateTimeField) – Date
  • upload_type (CharField) – Upload type
  • status (CharField) – Status
  • additional_info (JSONField) – Additional info
  • file_id (ForeignKey) – File
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception DepositRecord.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

DepositRecord.additional_info

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

DepositRecord.date

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

DepositRecord.file

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

DepositRecord.file_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

DepositRecord.get_next_by_date(*moreargs, **morekwargs)
DepositRecord.get_previous_by_date(*moreargs, **morekwargs)
DepositRecord.get_status_display(*moreargs, **morekwargs)
DepositRecord.get_upload_type_display(*moreargs, **morekwargs)
DepositRecord.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

DepositRecord.identifier

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

DepositRecord.oairecord

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

DepositRecord.oairecord_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

DepositRecord.objects = <django.db.models.manager.Manager object>
DepositRecord.paper

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

DepositRecord.paper_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

DepositRecord.repository

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

DepositRecord.repository_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

DepositRecord.request

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

DepositRecord.status

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

DepositRecord.upload_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

DepositRecord.user

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

DepositRecord.user_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class deposit.models.Repository(*args, **kwargs)[source]

Bases: django.db.models.base.Model, caching.base.CachingMixin

This model stores the parameters for a particular repository.

The name, description, url and logo fields are used in the user interface to present the repository.

The protocol field should contain the name of a subclass of RepositoryProtocol which implements the API supported by the repository. Note that this subclass needs to be registered in the protocol_registry in order to be available at runtime.

The api_key, username, password and endpoint are parameters used by the protocol implementation to perform the deposit.

Parameters:
  • id (AutoField) – Id
  • name (CharField) – Name
  • description (TextField) – Description
  • url (URLField) – Url
  • logo (ImageField) – Logo
  • protocol (CharField) – Protocol
  • oaisource_id (ForeignKey) – Oaisource
  • username (CharField) – Username
  • password (CharField) – Password
  • api_key (CharField) – Api key
  • endpoint (CharField) – Endpoint
  • enabled (BooleanField) – Enabled
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Repository.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Repository.api_key

An API key required by the protocol

Repository.depositrecord_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Repository.description

Description

Repository.enabled

Setting this to false forbids any deposit in this repository

Repository.endpoint

The API’s endpoint

Repository.get_implementation()[source]

Creates an instance of the class corresponding to the protocol identifier, bound with this repository. If the class cannot be found in the protocol_registry, None is returned.

Returns:the class corresponding to the value of the protocol field.
Repository.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Logo

Repository.name

Name

Repository.oaisource

The source with which the OaiRecords associated with the deposits are created

Repository.oaisource_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Repository.objects = <deposit.models.RepositoryManager object>
Repository.password

The password for that account

Repository.protocol

The identifier of the interface (protocol) used for that repository

Repository.protocol_for_deposit(paper, user)[source]

Returns an instance of the protocol initialized for the given paper and user, if initialization succeeded.

Returns:an instance of the protocol implementation, or None if the instance failed to initialize with the given paper and user.
Repository.url

URL of the homepage (ex: http://arxiv.org/ )

Repository.username

The identifier of the account under which papers should be deposited

class deposit.models.RepositoryManager[source]

Bases: caching.base.CachingManager