Craeg Strong wrote:
> Here is the theory behind the "guts" :)
>
> transform()
> Never throws an exception. Success/error messages
> are returned as a string
>
> transformGuts()
> Throws an exception in the case of error. Returns
> a string only in the success case
>
> Making transformGuts part of the interface makes it possible
> for someone to call this from another Zope Product that
> wants to capture exceptions. For example: ZOODocument :-)
> Alternatively, you might capture exceptions in a
> PythonScript and display them in some other way (?)
>
> Removing the method results in a loss of information
> b/c there is no way to programmatically tell if an
> error has happened.
Pretending to be the devil's advocate: why would you _not_ want
transform to raise an exception? If transformation fails, there is most
likely an error in your configuration or in your XSLT script. Also, Zope
provides a facility to customize the display of error messages
(standard_error_messages). Why should XSLTMethod try to go around that
and display the error message in plain text, or even worse, display
nothing. This makes debugging very hard.
> Perhaps transformGuts() should instead be called
> transformOrRaiseException() or something? It might be
> simply a case of poor naming...
Looks like it...
> Is there a Zope3 convention that might be helpful here?
Well, yeah. Exceptions are defined in the interface modules and are
being raised when appropriate. This is the convention ;)
Philipp
|