|
a/Ming/ming/schema.py |
|
b/Ming/ming/schema.py |
|
... |
|
... |
131 |
if self.required:
|
131 |
if self.required:
|
132 |
raise Invalid('Missing field', value, None)
|
132 |
raise Invalid('Missing field', value, None)
|
133 |
else:
|
133 |
else:
|
134 |
if self.if_missing is Missing:
|
134 |
if self.if_missing is Missing:
|
135 |
return self.if_missing
|
135 |
return self.if_missing
|
136 |
elif isinstance(self.if_missing, (types.FunctionType, types.MethodType)):
|
136 |
elif isinstance(self.if_missing, (
|
|
|
137 |
types.FunctionType,
|
|
|
138 |
types.MethodType,
|
|
|
139 |
types.BuiltinFunctionType)):
|
137 |
return self.if_missing()
|
140 |
return self.if_missing()
|
138 |
else:
|
141 |
else:
|
139 |
return deepcopy(self.if_missing) # handle mutable defaults
|
142 |
return deepcopy(self.if_missing) # handle mutable defaults
|
140 |
elif value == self.if_missing:
|
143 |
elif value == self.if_missing:
|
141 |
return value
|
144 |
return value
|