[Zope3-Users] Re: schema.List validation does not accept PersistentList

Fred Drake fdrake at gmail.com
Thu Jul 19 22:25:10 EDT 2007

On 7/19/07, Leonardo Rochael <leo at enfoldsystems.com> wrote:
> They seem to do the right thing (I fixed one of the cases when it didn't).
> Check zope/app/form/browser/itemswidgets.py:MultiDataHelper._toFieldValue()
>         if hasattr(self.context, '_type'):
>             _type = self.context._type
>             if isinstance(_type, tuple):
>                 _type = _type[0]
>             return _type(values)

Ah, so they have to violate encapsulation to do it.  I'd suggest this
is a hack, as it

- references a "protected" member of the context

- makes assumptions about how instances of the type are constructed

These are moderately safe assumptions in practice, but they're exactly that.


Fred L. Drake, Jr.    <fdrake at gmail.com>
"Chaos is the score upon which reality is written." --Henry Miller

More information about the Zope3-users mailing list