[Zope3-dev] Default value of fields

Bjorn Tillenius bjoti777 at student.liu.se
Wed Sep 24 06:31:17 EDT 2003


I think I found some errors in the widget code, but I'm not quite
sure how to fix it. Could someone explain to me how things are
supposed to work?

If I specify a field to have a default value and I use an add form,
that default value should show up there, right? Well, it doesn't
right now.

One thing that troubles me is that in the end of setUpWidget,
widget.setRenderedValue is called if widget.hasInput is false (which
it is). This results in widget._data to get set to None.

Then in BrowserWidget._showData, the default value is only returned
if 'widget._data is widget._data_marker and not widget.hasInput()'. But
since widget._data got set to None that condition will evaluate to False
and widget._data gets returned.

What is widget._data_marker used for? I havn't found any documentation
about it. 

Is 'not widget.hasInput()' really a sufficient condition on whether to
call setRenderedValue or not? Since this will always be true when using
an add form, 'widget._data is widget._data_marker' will always be false.

Regards,
  Bjorn



More information about the Zope3-dev mailing list