[Zope3-dev] Re: Field binding considered icky

Garrett Smith garrett at mojave-corp.com
Tue Apr 6 16:01:50 EDT 2004


That sounds good to me, though Fred's suggestion might be a good
amendment.

 --Garrett

"Jim Fulton" <jim at zope.com> wrote on 4/5/04 7:42 am:

Garrett Smith wrote:
> Maybe this is a silly question, but why not just pass the context to
the
> field validate method?
> 
>    field.validate(value, context)
 >
> Using adapters seems like a lot of infrastructure for something like
> validation. I assume you see other advantages, beyond cleanup?

Because most fields aren't context sensitive.  More importantly, many
applications won't have any notion of context-sensitivity.  "Context" is
a highly zope-specific concept.  I think we need it in Zope, but I don't
think most non-zope applications of schema will need it and I don't want
to encumber non-zope applications with the concept.

Of course, adaptation is pretty heavy to.

Perhaps we should compromise and and keep the existing validate methods
without binding.  In *Zope*, when validating, we'll *try* to get an
adapter
for the field and context and, if that fails, just call validate on the
field.

This feels like the right approach to me.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org







More information about the Zope3-dev mailing list