[Pangloss] [RFC] OpenFrame AppKit ideas

Jean-Michel Hiver jhiver at mkdoc.com
Tue Apr 8 21:57:44 BST 2003


> I was thinking of using try/catch blocks from the Error module.  But 
> both would achieve the same ends.

The exception mechanism does not work when you're validating a form 
because you do not want a validation error to be fatal since you might 
want to report multiple errors.


> I like your idea of passing the error object to the template, but I'd 
> change the name from 'self' to 'error'.  So I guess I got it wrong in 
> saying the TemplateLoader should copy across all the error vars using 
> the 'error.' prefix..
> 
> Also, instead of things like 'as_xhtml()', I prefer limiting the errors 
> to simple flags that the template writer uses to decide what text to write:
> 
>     'error.name_required'    => $flag

I find it really nice to have an as_xhtml() method coupled with 
templates for your error because then you don't need to do a bunch of 
ifs in your template. I thought that was what polymorphism was all about 
- avoid pesky ifs and switch-like statements.

But I also like the idea of your error having an ID for each error so 
that you can override the way the error is presented if you want to...

I suppose as a rule of thumb you could have ID = template name. Then 
your errors would be templatable, potentially easily multi-lingual, but 
also overridable. Although I doubt very much that you'll have to change 
them very often. After all 'Not enough disk space' remains 'not enough 
disk space'... If not, it's probably another kind of error. Am I making 
any sense?

Cheers,
Jean-Michel.



More information about the Pangloss mailing list