Fedora

Model mixins

class erudit.fedora.modelmixins.FedoraMixin

The FedoraMixin defines a common way to associate Django models and its instances to eulfedora’s models and Erudit’s objects’

get_erudit_class()

Returns the liberuditarticle’s class associated with the considered Django model.

get_erudit_object()

Returns the liberuditarticle’s object associated with the considered Django object.

get_fedora_model()

Returns the eulfedora’s model associated with the considered Django model.

get_fedora_object()

Returns the eulfedora’s object associated with the considered Django object.

get_full_identifier()

Returns the full identifier of the considered object. By default the FedoraMixin assumes that this identifier can be accessed through a localidentifier model field. But it can be computed from parent objects in order to get identifiers of the form: nb1.nb2.

Objects

class erudit.fedora.objects.ArticleDigitalObject(api, pid=None, create=False, default_pidspace=None)

Fedora object of an article

infoimg_dict

Returns the content of the INFOIMG datastream as a dictionary.

xml_content

Return the XML content of the article

An Article object contains datastreams for one or more of the following schema specifications.

In the case where an article contains multiple XML representation of itself, they will be processed in the following order:

  1. ERUDITXSD300
  2. SESAMEXSD
  3. ERUDITXSD200

Uses liberuditarticle to parse the content of the XML document and return a python object.

Retourne:a python object representing the article’s content
class erudit.fedora.objects.JournalDigitalObject(api, pid=None, create=False, default_pidspace=None)

Fedora objectf of a Journal

xml_content

Returns the XML content of the publications.

The XML content comes from the PUBLICATIONS datastream.

class erudit.fedora.objects.MediaDigitalObject(api, pid=None, create=False, default_pidspace=None)

Fedora object of a media file.

class erudit.fedora.objects.PublicationDigitalObject(api, pid=None, create=False, default_pidspace=None)

Fedora object of an Issue

xml_content

Returns the XML content of the publication.

The XML content comes from the SUMMARY datastream.

Generic views

This module defines generic class-based views to use in order to achieve common tasks that involve Fedora and datastreams.

class erudit.fedora.views.generic.FedoraFileDatastreamView(**kwargs)

Bases: django.views.generic.detail.SingleObjectMixin, django.views.generic.base.View

The FedoraFileDatastreamView CBV can be used to expose Fedora file datastreams through Django views.

FedoraFileDatastreamView.get_content_type(fedora_object)

Returns the content type that will be used to return the content of the file.

By default this requires self.content_type to be specified but subclasses can override this method to change this. This method can also be overriden in order to add extra headers if applicable.

FedoraFileDatastreamView.get_datastream_content(fedora_object)

Returns the content of the considered Fedora datastream.

By default this requires self.datastream_name to be specified but subclasses can override this to change this.

FedoraFileDatastreamView.get_fedora_object()

Returns the fedora object whose file content is being displayed by the view.

By default this requires self.fedora_object_class to be specified but subclasses can override this to return any Fedora digital object.

FedoraFileDatastreamView.get_fedora_object_pid()

Returns the PID of the fedora object that will be retrieved by the view.

By default this has the same requires as the get_object method because the considered object is expected to be an instance of a Fedora Django model, which is helpful to retrieve the Fedora PID. But subclasses can override this to control the way the Fedora PID is generated.

FedoraFileDatastreamView.get_response_object(fedora_object)

Returns the HttpResponse object that will contain the content of datastream.

This method can be overriden in order to add extra headers if applicable.

FedoraFileDatastreamView.write_datastream_content(response, content)

Writes the content of the Fedora datastream to the HttpResponse object.

FedoraFileDatastreamView.write_to_response(fedora_object)

Writes the content of the fedora object’s datastream to an HttpResponse object and return it.