[Grok-dev] schema.List returns a list, but is it persistent?

Leonardo Rochael Almeida leorochael at gmail.com
Fri Aug 28 13:43:42 EDT 2009


On Fri, Aug 28, 2009 at 14:40, Kevin Teague<kevin at bud.ca> wrote:
> I think instead of writing this:
>
>  tags = schema.List(title=u"Content Tags", default = [])
>
> You could write this?
>
>  tags = schema.List(title=u"Content Tags", default =
> persistent.list.PersistentList())

The problem with this approach, besides the "WrongType error" is that
only the default value would be a persistent list. As soon as a form
is submitted with a valid, but different, value, this value would be a
regular list.

> This is simpler than making a new schema field type. Not 100% sure how
> it works with applyData, but I think it should work? Annoyingingly
> though, the above will throw a WrongType error, but it does look like
> a fix was proposed for this (no one objected, but it also looks like
> the fix wasn't made either):


More information about the Grok-dev mailing list