[Zope3-Users] Why does schema validation not work in this example?
Sebastian Bartos
seth.kriticos at googlemail.com
Sun Jan 18 03:26:09 EST 2009
Hello folks,
I just played around with the validation of the schemata and created the
example listed below. According to the book by Philip it should rase a
validation exception at the end. That's what the FieldProperty is
supposed to do, but it does not do it here. (Tested in the zope debug
console) Why?
from zope.interface import Interface, implements
from zope.schema import Int
from zope.schema.fieldproperty import FieldProperty
class ITest(Interface):
number = Int( title = u'A number' )
class test(object):
implements(ITest)
number = FieldProperty(ITest['number'])
test_class = test()
print test.number # get <zope.schema.fieldproperty.FieldProperty object at 0x27537d0>
test.number = 20 # this is ok
print test.number # get 20
test.number = "not an int" # should raise exception, does not, why?
--
Sebastian Bartos, <seth.kriticos at googlemail.com>
keyserevr: pgp.mit.edu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20090118/27a15591/attachment.bin
More information about the Zope3-users
mailing list