[Zope] zope.schema field validators with access to context?

Jens Vagelpohl jens at dataflake.org
Mon Mar 19 17:51:30 EDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm currently working on teaching myself Zope 3/Five by converting  
one of my products to as many new technologies as I can put in. I'm  
coming against one issue that must be a pretty common pattern, at  
least for Zope 2/Five applications, which I haven't been able to solve:

I have a schema field where I want to validate the value based on  
information stored on the container where the object with the schema  
in question is stored (or will be stored, in the case of a formlib  
addview). I can see that fields are not context-aware by default, but  
they do have a method "bind" to generate a clone that does have  
access to the current context. However, the programmer has to pass a  
context (any context, really) to this method himself, but when the  
validation/constraints are called up there is no context.

How do others handle this situation?

jens

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFF/wXjRAx5nvEhZLIRAto3AJwITSUVoznLqyDR1ZmEurUSR5RWRQCdG0q+
tk7JP4wUKnWq6oTFn2ZvKRA=
=Gk9T
-----END PGP SIGNATURE-----


More information about the Zope mailing list