-
Notifications
You must be signed in to change notification settings - Fork 144
Open
Description
Currently when you serialize values, there is no preparer step before passing it off to the sub-types (in the case of the MappingSchema)
Lines 2276 to 2293 in 141263a
| 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.
JasperVanDenBosch and tejasshah-MK
Metadata
Metadata
Assignees
Labels
No labels