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

2007-08-24 Thread Stephan Richter
On Friday 24 August 2007 04:00, Christian Zagrodnick wrote:
 What should we do about this?

Well, I personally think for a programming API the error message is okay. The 
__repr__ could be better though, I agree.

For forms and other UI components, this text should be at most used for a 
default. z3c.form allows you to easily customize those error messages, for 
example.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics  Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



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

2007-08-24 Thread Christian Theune
Am Freitag, den 24.08.2007, 09:05 -0400 schrieb Stephan Richter:
 On Friday 24 August 2007 04:00, Christian Zagrodnick wrote:
  What should we do about this?
 
 Well, I personally think for a programming API the error message is okay. The 
 __repr__ could be better though, I agree.
 
 For forms and other UI components, this text should be at most used for a 
 default. z3c.form allows you to easily customize those error messages, for 
 example.

As long as this doesn't mean that we don't provide reasonable values in
the first place and force pretty much everybody to easily customize ...


___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



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

2007-08-24 Thread Stephan Richter
On Friday 24 August 2007 09:10, Christian Theune wrote:
  For forms and other UI components, this text should be at most used for a
  default. z3c.form allows you to easily customize those error messages,
  for example.

 As long as this doesn't mean that we don't provide reasonable values in
 the first place and force pretty much everybody to easily customize ...

Absolutely. I just do not think that we should make the error string try to 
fit everyone's needs. For example, using the current model, inserting the 
values into the docstring might be hard, because of internationalization. I 
would prefer providing human-readable error messages where  they belong, the 
UI code.

Mmmh, maybe I should write nicer messages for the standard exceptions in 
z3c.form.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics  Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



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

2007-08-24 Thread Jim Fulton


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:[EMAIL PROTECTED]Python 
Powered!
CTO (540) 361-1714  
http://www.python.org
Zope Corporationhttp://www.zope.com http://www.zope.org



___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



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

2007-08-24 Thread Stephan Richter
On Friday 24 August 2007 09:52, Jim Fulton wrote:
  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.

They are, but the text is used by the views to show the error. This makes 
people be lazy and not create custom error views for each error. I will take 
some time in the next days creating nicer error views for the zope.schema 
exceptions in z3c.form.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics  Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com