On 11 July 2010 01:56, Michael Howitz <m...@gocept.com> wrote:
> Hi Wichert,
>
> In Revision r112225 (see [1]) you make sure that the DictionaryField data 
> manager conforms to the interface by raising an exception in 
> datamanager.get() when a requested key is not found in the underlying 
> dictionary.
>
> Although it is nice to conform to the interface, this changes breaks code in 
> a project of mine: z3c.form.form.applyChanges uses datamanager.get() to check 
> whether the value has changed. Before r112225 this call returned the 
> field.missing_value when the requested key does not exist. Now it raises an 
> AttributeError, so applyChanges cannot continue.
>
> I'm not sure whether it was intended that now all keys must exist in the 
> dictionary.

I think this should be consistent with AttributeField. This does:
return getattr(self.adapted_context, self.field.__name__) which would
indeed raise an AttributeError if the field doesn't exist.

> In r114527 I prepared a change on a branch which uses datamanager.query() get 
> the old value for comparison which allows that keys can be missing again in 
> the dictionary.

This seems like the use case query() was designed for...

> I'd like to merge this change (it breaks no tests) into the trunk. Any 
> objections?

+1 for this change

Martin
_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )

Reply via email to