[Zope-dev] zope.schema validation can create read/write conflicts

Souheil CHELFOUH trollfot at gmail.com
Wed Dec 22 17:48:17 EST 2010


Hello,

I've been experiencing, for quite some time, now, read/write conflicts
in my projects.
I've decided to hunt the problem down and it brought me down to the
field validation in zope.schema.

My use case is the following :

class SomeAdapter(object):
   my_object = FieldProperty(ISomeInterface['my_object'])

   def __init__(self, context):
       self.my_object = context


If "my _object" from ISomeInterface is an Object field and has a
'schema' property, zope.schema will validate it.
The validation code writes an attribute on the value that is being
validated and therefore can create a read/write error.

The incriminated code is here :
http://svn.zope.org/zope.schema/trunk/src/zope/schema/_field.py?rev=111614&r1=110535&r2=111614

In my case, the value was an OOBTree and that caused a lot of read/write errors.
Can we do something about this validation code ?
Could it be a possible solution to change the "__validating_schema"
attribute into a _v_ attribute, to avoid the persistency ?

Thank you for reading me.

- Souheil


More information about the Zope-Dev mailing list