Jaymon / prom

A PostgreSQL or SQLite orm for Python
MIT License
22 stars 4 forks source link

Field.instance_type #129

Closed Jaymon closed 3 years ago

Jaymon commented 3 years ago

Right now, in some project code, we are looking at the field_type using the self.original_type but that can give us a string path like some.module, so it would be good to have a Field.instance_type that will convert to the actual type the instance is (you could use Field.type for this since that is currently just an alias for Field.interface_type).

That way, we don't have to keep adding gating logic like this when we are checking types:

val_type = self.original_type

if not isinstance(val_type, basestring):
    if issubclass(val_type, (int, float, bool)):
        pass
Jaymon commented 3 years ago

At some point between May 5 and June 25, 2021 this got addressed