heat.objects.fields module¶
- class heat.objects.fields.Json[source]¶
Bases:
FieldType
- coerce(obj, attr, value)[source]¶
This is called to coerce (if possible) a value on assignment.
This method should convert the value given into the designated type, or throw an exception if this is not possible.
- Param:obj:
The VersionedObject on which an attribute is being set
- Param:attr:
The name of the attribute being set
- Param:value:
The value being set
- Returns:
A properly-typed value
- from_primitive(obj, attr, value)[source]¶
This is called to deserialize a value.
This method should deserialize a value from the form given by to_primitive() to the designated type.
- Param:obj:
The VersionedObject on which the value is to be set
- Param:attr:
The name of the attribute which will hold the value
- Param:value:
The serialized form of the value
- Returns:
The natural form of the value
- to_primitive(obj, attr, value)[source]¶
This is called to serialize a value.
This method should serialize a value to the form expected by from_primitive().
- Param:obj:
The VersionedObject on which the value is set
- Param:attr:
The name of the attribute holding the value
- Param:value:
The natural form of the value
- Returns:
The serialized form of the value