Commit b3281516 authored by Alexei Kornienko's avatar Alexei Kornienko
Browse files

Merge branch 'andrey/polymodel_converty' into 'master'

Refactor polymodel convert according to base model type

See merge request !35
parents 0fde5a79 a4dbc8a4
......@@ -397,7 +397,10 @@ class PolyModelType(CompoundType):
'an instance of {}').format(instanceof_msg))
model_class = self.find_model(value)
return model_class(value, context=context)
if context.convert and context.oo:
return model_class(value, context=context)
else:
return model_class.convert(value, context=context)
def find_model(self, data):
"""Finds the intended type by consulting potential classes or `claim_function`."""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment