[Zope3-Users] Re: schema.List validation does not accept
PersistentList
Leonardo Rochael
leo at enfoldsystems.com
Thu Jul 19 19:42:25 EDT 2007
Fred Drake wrote:
>
> [...]
> You probably want to check the results of the edit widgets; they might
> produce list values instead of PersistentList values. Widgets are not
> expected to edit the value in place, but to produce a new value.
>
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()
(Link to file on svn: http://tinyurl.com/28zzvd )
# All AbstractCollection fields have a `_type` attribute specifying
# the type of collection. Use it to generate the correct type,
# otherwise return a list. TODO: this breaks encapsulation.
if hasattr(self.context, '_type'):
_type = self.context._type
if isinstance(_type, tuple):
_type = _type[0]
return _type(values)
else:
return values
--
View this message in context: http://www.nabble.com/schema.List-validation-does-not-accept-PersistentList-tf4109785.html#a11699887
Sent from the Zope3 - users mailing list archive at Nabble.com.
More information about the Zope3-users
mailing list