The implementation of applyData returns lists that aren't automatically persistent.

Bug #419305 reported by jhsware on 2009-08-26
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
grok
Undecided
Unassigned
zope.formlib
Undecided
Unassigned

Bug Description

If you have a form based on a schema.List item,

  tags = schema.List(title=u"Content Tags", value_type=schema.Choice(title=u"Content Tag", vocabulary='Content Tags'), default = [])

then applyData stores the results as a regular list() data type instead of the persistent PersistenList() data type. This is ok as long as you only manipulate the data with applyData, but that is quite a wild assumption.

I suggest changing the implementation of applyData to ALLWAYS use persistent data types, such as PersistentList. Otherwise an oversight might lead to very subtle but serious bugs resulting in loss of data.

trollfot (trollfot) wrote :

The result of a form is not always meant to be persistent.
The persistency is usually implemented in the Model itself, when you set the value of the attribute, for example.
The behavior described here is the intended one.

Changed in zope.formlib:
status: New → Invalid
Changed in grok:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers