Am 12.01.2006 um 20:21 schrieb Alvin Wang:

Any way, ideally
class Author(SQLObject):
        name = StringCol(length = 255)
        description = StringCol( length = 255, form_min=10)
        yearspublished = IntCol( form_min=1, form_max=10)
        socialsecnumber = IntCol( form_mask='999-99-9999')

basically, have SQLobject pass through anything it does not understand
like XML attributes.  Anyway of passing an array of parameters per
field would work.

assuming that you have a limited set of extra attributes for each type, you could create classes like:

class ValidatingStringCol(StringCol):
    def __init__(self, **kw):
        self.form_min = kw.pop("form_min", None)
        self.form_max = kw.pop("form_max", None)
        super(ValidatingStringCol, self).__init__(**kw)

and use these instead of the original sqlobject classes.

ciao
Martina

Reply via email to