Closed Jaymon closed 4 years ago
This was my bad, this would've worked if I did this:
from prom import Orm, Field
class BaseOrm(Orm):
@classmethod
def normalize(cls, instance, val):
return "{:0>5}".format(val)
foo = Field(str, True, size=5, fset=BaseOrm.normalize)
Notice the method signature of the normalize
method is (cls, instance, val)
instead of just (cls, val)
, I forgot the instance
param, that's what I was doing wrong.
This didn't work
It failed with this stack trace: