[Zope-dev] Stumped about handling this particular exception...
Tres Seaver
tseaver@palladion.com
Wed, 28 Apr 1999 22:02:50 -0500
Jim Fulton wrote:
> Amos Latteier wrote:
> >
>
> (snip)
>
> > It may be that ZPublisher doesn't have much business validating form input.
>
> I agree. ;)
>
> > When I complain to Jim Fulton that the converters are pretty lame he
> > usually tells me that they are not for form validation, but for argument
> > marshalling.
>
> Exactly. Input validation, error reporting, and other UI activities
> should be done at a much higher level. ZPublisher is a very low-level
> tool meant for basic communication.
Actually, the ideal would be to have as much of the shallow, "pure UI" type
validation happen on the client side: required fields, valid integers / dates /
phone numbers, etc. Only "deep" validations (those which depend on actual
business logic) should be done in Zope. I recall a chunk of DTML from this list
which I used at one point (but can't find now :) to generate simple JavaScript
validations, based on the converter types. Worked nicely, if in a fairly
limited scope.
>
> Obviously, we made the mistake early on of introducting "required",
> which really is an input validation feature. This was before we realized
> that we couldn't hope to do a good job of validation at such a low level.
>
>
> > Improving the ZPublisher converters is a worthwhile problem, IMO.
>
> I agree, It would be nice to do more sophisticated marshalling. ;)
>
> > In
> > addition, making ZPublisher's error reporting more flexible is also a
> > worthwhile project.
>
> Well, It would be worthwhile to make ZPublisher provide better hooks
> to let application handle errors detected by ZPublisher. This is
> definately on the to do list.
>
> I also think that a default value mechanism of some kind would
> make sense. This would help in other situations too.
I personally would like to see the default behavior for exception handling be to
render the exception object as visible HTML. While a Python backtrace might be
disconcerting to some users, the "sorry, this site is experiencing technical
difficulties" is hardly less so.
--
=========================================================
Tres Seaver tseaver@palladion.com 713-523-6582
Palladion Software http://www.palladion.com