colander
colander copied to clipboard
default empty values don't work in serialize()
e.g.
class Data(colander.MappingSchema):
name = colander.SchemaNode(colander.Str(), missing='', default='')
works as expected on deserialization, but not on serialization, where the node becomes null instead of ''.
possible fix
cstruct = self.typ.serialize(self, appstruct)
if cstruct is null:
cstruct = self.default
return cstruct
in SchemaNode.serialize