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.

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:

  • module Module in which the request is stored. The type and action modules are derived from it but can override the default.

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

    • module
    • class
    • bases
    • imports
    • generate True by defualt, False is typically used when user provides custom Type class.
    • parent-actions Request type class specifies actions that can be performed by the request. By default the class imports its parent's possible actions, but this behavior can be customized if the parent class has different structure for some reason.
  • actions A list of customized actions by this type of request. Only the accept action is supported for now.

    • module

    • class Analogous to type class for the action. By default it's invenio_requests.customizations.AcceptAction.

    • bases

    • imports

    • generate Analogous to type class for the action.

    • bases Analogous to type class bases for the action.

It also allows specifying the topic record resolver used. The resolver is tied to the topic class therefore it's generated on record level instead of the request. Configurable options:

  • module
  • class
  • bases
  • imports
  • generate
  • custom-proxy-class The resolver can use different proxy record resolution class. This is needed for resolving drafts because they don't have registered PIDs.

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-4.1.4.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file oarepo_model_builder_requests-4.1.4.tar.gz.

File metadata

File hashes

Hashes for oarepo_model_builder_requests-4.1.4.tar.gz
Algorithm Hash digest
SHA256 73d15d78fd8bdcd4d4e98477295e62ef59a7e101dfd4ab77c2cc17ae28024b93
MD5 1d675872dfb44199e2152761eeee80fc
BLAKE2b-256 758c793eb778d15d8de569e6b40aab44b63ee85edbf0b842e3aa9dd4d541fe6a

See more details on using hashes here.

File details

Details for the file oarepo_model_builder_requests-4.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for oarepo_model_builder_requests-4.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 daee1b2857fcfca119fa442b08b8ef9c699e4c77af786f5c793978347dc9b231
MD5 fd2ad44ded9c65f8a3ce9e7fac2d5808
BLAKE2b-256 124dc0ba9596e98dae4b6aca6a86002f919e2fea300254285f3c62b797069a68

See more details on using hashes here.

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