Publish
In order to make content files available to clients, users must publish these files. Typically, users will publish a repository which will make the content in the repository available.
When publishing a repository, your plugin needs to mimic the layout of both data and metadata. In the simplest case for content types that don’t have metadata, only the content unit data itself needs to be published.
In most cases, both metadata and content unit data are required to make a usable publication. It’s important to understand what the required metadata is for your content type.
Using a Publication
context manager is highly encouraged. On
context exit, the complete attribute is set True provided that an exception has not been raised.
In the event an exception has been raised, the publication is deleted.
One of the ways to perform publishing:
Find
ContentArtifact
objects which should be publishedFor each of them create and save instance of
PublishedArtifact
which refers toContentArtifact
andPublication
to which this artifact belongs.Generate and write to disk repository metadata
For each of the metadata files create an instance of
PublishedMetadata
using create_from_file constructor. Each instance relates a metadata file to aPublication
.Use
ProgressReport
to report progress of some steps if needed.