[Grok-dev] schema.List returns a list, but is it persistent?
Leonardo Rochael Almeida
leorochael at gmail.com
Wed Aug 26 12:13:52 EDT 2009
On Wed, Aug 26, 2009 at 12:25, Leonardo Rochael
Almeida<leorochael at gmail.com> wrote:
>
> [...]
>
> On the other hand, it's very easy to create your own class that
> extends from schema.List to return your own datatype. IIRC you only
> have to override one attribute in the subclass, and it will receive
> the same widgets as the superclass unless you register differently or
> alter the implemented interfaces.
The attribute is _type, btw. The reason PersistentList is not the
default is because zope.schema doesn't assume you're going to use it
with zodb.
Cheers, Leo
>
> Cheers, Leo
>
> On Wed, Aug 26, 2009 at 11:56, Sebastian Ware<sebastian at urbantalk.se> wrote:
>> Lists need to be implemented as PersistentList in order to be
>> automatically persisted to ZODB, however schema.List returns an
>> ordinary list and applyData seemingly stores this list as is. Isn't
>> this a big problem?
>>
>> tags = schema.List(title=u"Content Tags",
>> value_type=schema.Choice(title=u"Content Tag",
>> vocabulary='Content Tags'), default = [])
>>
>> Mvh Sebastian
>>
>>
>> _______________________________________________
>> Grok-dev mailing list
>> Grok-dev at zope.org
>> http://mail.zope.org/mailman/listinfo/grok-dev
>>
>
More information about the Grok-dev
mailing list