Skip to main content

No project description provided

Project description

OARepo model builder requests

Plugin for oarepo-model-builder to allow specifying requests tied to the base model, based on invenio requests.

Requests are requests for an action concerning an instance of the model (called topic in this context), for example to publish the topic.

The requests are specified as request types (each type has its own class). Each request type has pre-specified actions from the invenio framework. The plugin allows to customize the accept action.

By default, along with changing the request status, the generated accept action fetches the associated record. It's up to the developer to decide what to do with it further.

Types of requests can be added to the model through "requests" section in the yaml file of the model. There can be any number of them. Options in the yaml:

  • class Class for the Type of the request. Used if the user wants to use a custom request type class.

  • generate True by defualt, False is typically used when user provides custom Type class.

  • bases Base classes for the Type class.

  • actions A list of customized actions by this type of request. Only the accept action is supported for now.

Examples

For example, the requests plugin can be used for approving a thesis. The accept action can be used for approval. A simple yaml entry at the root level can be used:

requests:
  approve-thesis: {}

This generates all the basic files. The generated action does the predefined changes in the default invenio base class, specifically changes the request status, and provides a template for modifying the associated thesis record (topic). The template fetches the record and saves changes on it. What to do with the thesis during is up to the developer. They have to replace this code with their own implementation.

## todo - do something with the record
# topic["status"] = "accepted"
##

Alternatively, they can define the accept action class on their own and import it instead of generating.

requests:
  approve-thesis:
    class: thesis.requests.ApproveAction
    generate: False

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oarepo-model-builder-requests-3.1.1.tar.gz (11.1 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page