[Zope3-dev] Access to widget errors

Marius Gedminas mgedmin at b4net.lt
Tue Sep 14 02:10:57 EDT 2004


On Mon, Sep 13, 2004 at 10:19:12AM -0500, Garrett Smith wrote:
> Let me throw out another option, which parallels the use of _data to
> override form input:
> 
> 1 - Leave everything as is -- i.e. error is a method that looks up a
> view to _error.
> 
> 2 - Add a new method 'overrideError' -- which sets attr
> '_errorOverride':
> 
>   def overrideError(self, error):
>     setattr(self, '_errorOverride', error)
> 
> 3 - Modify error() to use _errorOverride, if it exists.
> 
>   def error(self):
>     if hasattr(self, '_errorOverride')
>       # lookup view on _errorOverride'
>     else:
>       # lookup view on _error
> 
> The new method is similar to setRenderedValue, but lets the view control
> the error rather than the value.
>
> I think treating error like label or hint is wrong because it's really
> something managed internally by the widget.

Good, I like this -- except for the view lookup part.  Use case #1 in my
proposal: I do not want error in HTML, I want an error message in a tooltip.

How about we make error a read-only property that returns the error
object and do the HTML rendering in widget_macros.pt?

Marius Gedminas
-- 
Funny, I never thought I'd find myself agreeing with a statement
containing both "lambda" and "more readable" ;^)
	-- Casey Duncan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope3-dev/attachments/20040914/f8cadc8c/attachment.bin


More information about the Zope3-dev mailing list