Menu
Introduction
Getting Started
Developer guide
Release
Architecture
CLI
Technical documentations
Version
Publication date

Mar 9, 2022

Confidentiality
Public
Reactions
1
Share

ResourceRField

.. deprecated:: ResourceRField is deprecated and will be removed in a future version. Please define a sub class of ResourceSet instead.

RField, these fields must be used in resource attribute This field is useful to link a resource with another resource without duplicating them. When the resource is saved after a task, the field must contains a Resource and if yes, this resource will be linked with the generated resource. Next time this resource is instantiated, the linked resource will be provided in the ResourceRField.

//!\ WARNING: the linked resource MUST be a resource provided as input of the task that generate the resource marked with ResourceRField. Otherwise there will be an error before saving the generated resource because it can break the tracability of resources

Attributes
include_in_dict_view: boolstorage: RFieldStorage
Functions
__init__

Initialize a BaseRField with storage and default value configuration.

deserialize

Convert a stored value into the field's runtime representation.

Called when loading a field value from storage. Override this method in subclasses to implement custom deserialization logic.

r_field_value : str
The raw value retrieved from storage
Return type : Resource
get_default_value

Get the default value for this field.

If the default value is a Type or Callable, it will be called to generate a new default value. Otherwise, the default value is returned directly.

This ensures that mutable defaults (like lists or dicts) are not shared between Resource instances.

Return type : Any
serialize

Convert the field's runtime value into a storable representation.

Called when saving a field value to storage. Override this method in subclasses to implement custom serialization logic.

r_field_value : Resource
The current field value in the Resource
Return type : str
Shine Logo
Technical bricks to reuse or customize

Have you developed a brick?

Share it to accelerate projects for the entire community.