[Zope3-dev] Re: small proposed widget change

Gary Poster gary at zope.com
Thu Sep 25 16:53:45 EDT 2003



Garrett Smith wrote:
> Gary Poster wrote:
> 
>> I would like to add an "error" method to IBrowserWidget, as described 
>> below.  The purpose is to be able to avoid using the "row" method, and 
>> use "label", "__call__", and the new "error" to render widgets in page 
>> templates.
> 
> 
> (repost)
> 
> This looks good.

cool.

> In the same spirit, is there a way to get at the field's info such as 
> 'required' and 'description' so that the template can determine how 
> these are rendered?

Required: yes.  See src/zope/app/interfaces/form.py line 160
Description: AFAIK no.

> Here are some items that I think should be handled by the skin, not hard 
> coded by the widgets:
> 
> - field label

Well, the label is just the translated title.  The title is already 
available from the widget (line 158 in the same file above).  Maybe the 
widget title should be a method (or, for backwards compatibility, a 
property) that returns the translated title: this would be sufficient 
for this use case, and code would still be able to get 
widget.context.title if the untranslated version needed.

> - field description (currently hardcoded as a tooltip)

Yes, good idea.

> - whether or not the field is required

Already there, as above.

> - error messages (as you've noted)

Right.

> - ??? more here ???

Other than the fact that we need to do a better job with the constraint 
errors, as I know a number of folks have discussed, not off the top of 
my head.

Gary




More information about the Zope3-dev mailing list