Hi,

I find that when I map a class to a table I lose the auto-magic
vaidation provided by FieldProperty when setting attributes.

class IMyObject(zope.interface.Interface):
   now = zope.schema.Datatime()

class MyObject(object):
   zope.interface.implements(IMyOBject)
   now = zope.schema.fieldproperty(IMyObject['now'])

object_table = sqlalchemy.Table(
        'object_table', z3c.zalchemy.metadata(),
        sqlalchemy.Column('now', sqlalchemy.DateTime))

sqlalchemy.orm.mapper(MyObject, object_table)

obj = MyObject()
obj.now = u'Not a date time object'

If I simply remove the mapper defintion

obj = MyObject()
obj.now = u'Not a date time object'
WrongType: (u'Not a date time object', <type 'datetime.datetime'>)

Has anyone found a work around? Because I would like to have data
validated without having to write code to do so.

Regards,
Darryl

_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to