[Zope3-dev] __repr__ of ValidationErrors in zope.schema

Jim Fulton jim at zope.com
Fri Aug 24 09:52:00 EDT 2007


On Aug 24, 2007, at 4:00 AM, Christian Zagrodnick wrote:

> Hi
>
> I'm implementing the getValidationErrors thingy right now and once  
> again stumbled upon the ValidationErrors. Their __repr__ is all but  
> useful.
>
> For instance "TooSmall":
>
>>>> TooSmall(8, 10)
> 8 10
>
> Another sort of related issue is that you only get the __doc__  
> string when calling the .doc() method. "Value is too small."  
> doesn't help a lot.
>
> Something like "The value 8 is too small. At least 10 is required."  
> would be much more informative.
>
> What should we do about this?

While better __str__s or __reprs__ is often nice, as a general  
principal, errors should be displayed through adaptation -- basically  
views.

Jim

--
Jim Fulton			mailto:jim at zope.com		Python Powered!
CTO 				(540) 361-1714			http://www.python.org
Zope Corporation	http://www.zope.com		http://www.zope.org





More information about the Zope3-dev mailing list