pydent.marshaller.SchemaModel¶
-
class
pydent.marshaller.SchemaModel(data=None)[source]¶ Bases:
objectA Schema class that holds information on serialization/deserialization.
The model initializer.
- Parameters
data (dict) – data to add to the model
-
__init__(data=None)[source]¶ The model initializer.
- Parameters
data (dict) – data to add to the model
Methods
__init__([data])The model initializer.
add_data(data)Initializes fake attributes that correspond to data.
dump([only, include, ignore])Dump/serializes the model to a json-like dictionary.
get_deserialized(name)Get deserialized data by name.
is_deserialized(name)Check if a given key has already been deserialized.
load(data)Deserialize the data to a model.
reset_field(name)Reset the field descriptor to its placeholder value, returning the behavior.
Attributes
model_schema-
dump(only=None, include=None, ignore=None)[source]¶ Dump/serializes the model to a json-like dictionary.
- Parameters
only (basestring|list|tuple|dict) – restricts dump/serialization to the provided keys
include (basestring|list|tuple|dict) – include any callback fields in the dump/serialization
ignore (basestring|list|tuple|dict) – ignores fields in the dump/serialization
- Returns
the serialized data
- Return type
dict
-
get_deserialized(name)[source]¶ Get deserialized data by name.
Deprecated since version 0.1.5a7: method will be removed in 0.2. Use self._get_deserialized_data[name] instead.
- Parameters
name – name of attribute
- Returns
-
is_deserialized(name)[source]¶ Check if a given key has already been deserialized.
New in version 0.1.5a7: Method added
- Parameters
name (
str) – name of the attribute- Return type
bool- Returns
True if key has been deserialized.