On Wednesday 13 August 2008, Hermann Himmelbauer wrote:
> The problem is, that if the dictionary does not contain all fields, an
> error is raised. The reason for this error lies in line 97 in
> z3c.form.widget: The value is retrieved via the get() function (which does
> a dict.get()) and thus fails.

That is correct. My initial assumption was that a dictionary should define all 
available fields, much like we expect a class instance to have all attributes 

> The solution for this problem would be to replace the datamanager.get() by
> datamanager.query(), as this would return the default field value.
> However, this may break other projects, therefore I would suggest to:
> - Introduce some form option such as "ContextQuery=True/False"
> - Either use dm.get() or .query() regarding to this option
> What's your opinion on this? Would this be a decent solution?

Looking at the code, I would change the call in widget.py line 97 to a query() 
call. There is another dm.get() call in the code that also would be changed. 
This feature could be added to the 1.9.0 release. Feel free to check in a 

Stephan Richter
Web Software Design, Development and Training
Google me. "Zope Stephan Richter"
Zope3-users mailing list

Reply via email to