Currently when you serialize values, there is no preparer step before passing it off to the sub-types (in the case of the MappingSchema)
|
def serialize(self, appstruct=null): |
|
""" Serialize the :term:`appstruct` to a :term:`cstruct` based |
|
on the schema represented by this node and return the |
|
cstruct. |
|
|
|
If ``appstruct`` is :attr:`colander.null`, return the |
|
serialized value of this node's ``default`` attribute (by |
|
default, the serialization of :attr:`colander.null`). |
|
|
|
If an ``appstruct`` argument is not explicitly provided, it |
|
defaults to :attr:`colander.null`. |
|
""" |
|
if appstruct is null: |
|
appstruct = self.default |
|
if isinstance(appstruct, deferred): # unbound schema with deferreds |
|
appstruct = null |
|
cstruct = self.typ.serialize(self, appstruct) |
|
return cstruct |
this means we can not influence the appstruct before passing it off to the various subtypes in the mapping schema
https://github.com/Pylons/colander/blob/master/colander/__init__.py#L811-L818
This doesn't match the deserialize API which has a preparer function that can be used to modify the cstruct before passing to children and or validation.
Currently when you serialize values, there is no preparer step before passing it off to the sub-types (in the case of the MappingSchema)
colander/colander/__init__.py
Lines 2276 to 2293 in 141263a
this means we can not influence the appstruct before passing it off to the various subtypes in the mapping schema
https://github.com/Pylons/colander/blob/master/colander/__init__.py#L811-L818
This doesn't match the
deserializeAPI which has apreparerfunction that can be used to modify thecstructbefore passing to children and or validation.