keepluggable.actions module¶
The base Action class.
- class keepluggable.actions.BaseFilesAction(orchestrator: keepluggable.orchestrator.Orchestrator, namespace: str)[source]¶
Bases:
object
Action class that coordinates the workflow.
You are likely to need to subclass this.
To enable this action, use this configuration:
action_cls = keepluggable.actions:BaseFilesAction
- class Config(*args, **kw)[source]¶
Bases:
colander.Schema
Validated configuration for BaseFilesAction.
max_file_size
(int): the maximum file length, in bytes, that can be uploaded. When zero, the system does not have a maximum size. Default: 0.allow_empty_files
(boolean): whether to allow zero-length files to be uploaded. Default: false.cls_update_metadata_schema
(dotted resource spec): Colander schema that validates metadata being updated. Without it, no validation is done, which is unsafe. So it is recommended that you implement a schema.
- delete_file(key: str) None [source]¶
Delete a file’s metadata and payload, including derived versions.
- gen_originals(filters=None) Iterable[Dict[str, Any]] [source]¶
Yield the original files in this namespace.
…optionally with further filters.
- classmethod get_config(settings: Dict[str, Any]) Dict[str, Any] [source]¶
Stuff called by the orchestrator at startup.
- store_original_file(bytes_io: BinaryIO, repo: Any, **metadata) Dict[str, Any] [source]¶
Point of entry into the workflow of storing a file.
You can override this method in subclasses to change the steps since it is a sort of coordinator that calls one method for each step.
The argument bytes_io is a file-like object with the payload. metadata is a dict with the information to be persisted in the metadata storage.