Jaymon / prom

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

Field.set_type should be able to modify options #128

Closed Jaymon closed 3 years ago

Jaymon commented 3 years ago

The whole point is to be able to define custom types, but this fails because .set_type(...) is called before the options are set, currently, I'm doing things like this:

foo = Field(FooStr, True, size=14)

And this is what set_type kind of looks like:

    def set_type(self, field_type, field_options):
        super(Field, self).set_type(field_type, field_options)
        if issubclass(field_type, FooStr):
            self._interface_type = str
            self.serializer = ""

And I would like to be able to set the size and stuff in options under self.serializer = ""

Jaymon commented 3 years ago

At some point between April 29 and June 25, 2021 this got addressed