OpenQuizz
Une application de gestion des contenus pédagogiques
Method Class Reference
Inheritance diagram for Method:
Collaboration diagram for Method:

Public Member Functions

def __init__ (self, typing.Optional[str] serialize=None, typing.Optional[str] deserialize=None, **kwargs)
 
- Public Member Functions inherited from Field
None __init__ (self, *typing.Any default=missing_, typing.Any missing=missing_, typing.Optional[str] data_key=None, typing.Optional[str] attribute=None, typing.Optional[typing.Union[typing.Callable[[typing.Any], typing.Any], typing.Iterable[typing.Callable[[typing.Any], typing.Any]],]] validate=None, bool required=False, typing.Optional[bool] allow_none=None, bool load_only=False, bool dump_only=False, typing.Optional[typing.Dict[str, str]] error_messages=None, typing.Optional[typing.Mapping[str, typing.Any]] metadata=None, **additional_metadata)
 
str __repr__ (self)
 
def __deepcopy__ (self, memo)
 
def get_value (self, obj, attr, accessor=None, default=missing_)
 
ValidationError make_error (self, str key, **kwargs)
 
def fail (self, str key, **kwargs)
 
def serialize (self, str attr, typing.Any obj, typing.Optional[typing.Callable[[typing.Any, str, typing.Any], typing.Any]] accessor=None, **kwargs)
 
def deserialize (self, typing.Any value, typing.Optional[str] attr=None, typing.Optional[typing.Mapping[str, typing.Any]] data=None, **kwargs)
 
def context (self)
 
- Public Member Functions inherited from FieldABC
def serialize (self, attr, obj, accessor=None)
 
def deserialize (self, value)
 

Data Fields

 serialize_method_name
 
 deserialize_method_name
 
- Data Fields inherited from Field
 default
 
 attribute
 
 data_key
 
 validate
 
 validators
 
 allow_none
 
 load_only
 
 dump_only
 
 required
 
 missing
 
 metadata
 
 error_messages
 
 parent
 
 name
 
 root
 

Additional Inherited Members

- Static Public Attributes inherited from Field
 default_error_messages
 
- Static Public Attributes inherited from FieldABC
 parent
 
 name
 
 root
 

Detailed Description

A field that takes the value returned by a `Schema` method.

:param str serialize: The name of the Schema method from which
    to retrieve the value. The method must take an argument ``obj``
    (in addition to self) that is the object to be serialized.
:param str deserialize: Optional name of the Schema method for deserializing
    a value The method must take a single argument ``value``, which is the
    value to deserialize.

.. versionchanged:: 2.0.0
    Removed optional ``context`` parameter on methods. Use ``self.context`` instead.

.. versionchanged:: 2.3.0
    Deprecated ``method_name`` parameter in favor of ``serialize`` and allow
    ``serialize`` to not be passed at all.

.. versionchanged:: 3.0.0
    Removed ``method_name`` parameter.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
typing.Optional[str]   serialize = None,
typing.Optional[str]   deserialize = None,
**  kwargs 
)

Field Documentation

◆ deserialize_method_name

deserialize_method_name

◆ serialize_method_name

serialize_method_name

The documentation for this class was generated from the following file: