Back to bricks list
Introduction
Technical Documentation
Other Classes
FileRField RField
Version

FileRField

Abstract class that must be extended to define RField that are dump and load directly into a file

Attributes

include_in_dict_view: boolsearchable: bool

Functions

__INIT__
               Only small amount of data can be mark as searchable, defaults to False
                  Support primitive value, Type of Callable function
                  If type or callable, it will be called without parameter to initialise the default value, defaults to None
                  Do not mark huge fields as include in dict view, defaults to False
Parameters:
NameTypeDefault valueDescription
default_valueAny Default value of the resource attribute union[type, callable[[], ], int, float, str, bool], optional
DESERIALIZE
Parameters:
NameTypeDefault valueDescription
r_field_valuestr
Return type:
Any
DUMP_TO_FILE

Implement this method to dump your object into a file to be able to load it later. This method is called when the resource is saved.

Parameters:
NameTypeDefault valueDescription
r_field_valueAny Object to dump (value of the r_field)
file_pathstr Path of the file to dump (the object must be dumped into this file)
GET_DEFAULT_VALUE
Return type:
Any
LOAD_FROM_FILE

Implement this method to load your object from the file. This method is called when the RField of the resource is loaded.

Parameters:
NameTypeDefault valueDescription
file_pathstr Path of the file
Return type:
Any
SERIALIZE

METHOD NOT USED. Ignore this method.

Parameters:
NameTypeDefault valueDescription
r_field_valueAny
Return type:
str