Made it possible to have multiple preparers.
This commit is contained in:
@@ -1667,7 +1667,13 @@ class SchemaNode(object):
|
|||||||
appstruct = self.typ.deserialize(self, cstruct)
|
appstruct = self.typ.deserialize(self, cstruct)
|
||||||
|
|
||||||
if self.preparer is not None:
|
if self.preparer is not None:
|
||||||
|
# if the preparer is a function, call a single preparer
|
||||||
|
if hasattr(self.preparer, '__call__'):
|
||||||
appstruct = self.preparer(appstruct)
|
appstruct = self.preparer(appstruct)
|
||||||
|
# if the preparer is a list, call each separate preparer
|
||||||
|
elif type(self.preparer) is list:
|
||||||
|
for preparer in self.preparer:
|
||||||
|
appstruct = preparer(appstruct)
|
||||||
|
|
||||||
if appstruct is null:
|
if appstruct is null:
|
||||||
appstruct = self.missing
|
appstruct = self.missing
|
||||||
|
Reference in New Issue
Block a user