Package coprs :: Package rest_api :: Module schemas :: Class SpaceSeparatedList
[hide private]
[frames] | no frames]

type SpaceSeparatedList

source code


Instance Methods [hide private]
 
_serialize(self, value, attr, obj)
Serializes ``value`` to a basic Python datatype.
source code
 
_deserialize(self, value, attr=None, data=None)
Deserialize value.
source code

Inherited from marshmallow.fields.Field: __init__, __repr__, deserialize, fail, get_value, serialize

Inherited from marshmallow.fields.Field (private): _add_to_schema, _validate, _validate_missing

Inherited from marshmallow.base.FieldABC: __deepcopy__

Class Variables [hide private]

Inherited from marshmallow.fields.Field: default_error_messages

Inherited from marshmallow.fields.Field (private): _CHECK_ATTRIBUTE, _creation_index

Inherited from marshmallow.base.FieldABC: name, parent

Properties [hide private]

Inherited from marshmallow.fields.Field: context, root

Method Details [hide private]

_serialize(self, value, attr, obj)

source code 

Serializes ``value`` to a basic Python datatype. Noop by default. Concrete :class:`Field` classes should implement this method.

Example: :

   class TitleCase(Field):
       def _serialize(self, value, attr, obj):
           if not value:
               return ''
           return unicode(value).title()

:param value: The value to be serialized. :param str attr: The attribute or key on the object to be serialized. :param object obj: The object the value was pulled from. :raise ValidationError: In case of formatting or validation failure. :return: The serialized value

Overrides: marshmallow.base.FieldABC._serialize

_deserialize(self, value, attr=None, data=None)

source code 
Deserialize value. Concrete :class:`Field` classes should implement this method.

:param value: The value to be deserialized.
:param str attr: The attribute/key in `data` to be deserialized.
:param dict data: The raw input data passed to the `Schema.load`.
:raise ValidationError: In case of formatting or validation failure.
:return: The deserialized value.

.. versionchanged:: 2.0.0
    Added ``attr`` and ``data`` parameters.

Overrides: marshmallow.base.FieldABC._deserialize