Added as_field utility

This commit is contained in:
Syrus Akbary 2016-06-18 14:32:53 -07:00
parent 3c2f2c3c06
commit ccd8349ef6

View File

@ -0,0 +1,10 @@
from ..types.field import Field
from ..types.unmountedtype import UnmountedType
def as_field(value):
if isinstance(value, UnmountedType):
return value.as_field()
elif isinstance(value, Field):
return value
raise Exception("{} is not a field".format(value))