Re: __repr__ of ValidationErrors in zope.schema
Philipp von Weitershausen <[email protected]>
| Newsgroups | gmane.comp.web.zope.zope3 |
|---|---|
| Message-ID | <[email protected]> |
Christian Zagrodnick wrote: > 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? I'd say, fix it :). You seem to have a pretty good understanding of how this should be fixed already. Note that a ValidationError's docstring is used for the error message in forms. A change will therefore likely cause functional tests to break, both within Zope and especially in 3rd party packages. I think this is an acceptable risk to take as long as we're *improving* the error messages (which is hard to do w/o breaking some ftests). -- http://worldcookery.com -- Professional Zope documentation and training