[XML-SIG] Re: python SAX API

Alexandre Fayolle Alexandre.Fayolle@logilab.fr
Fri, 16 Nov 2001 17:09:57 +0100 (CET)


On Fri, 16 Nov 2001, Juergen Hermann wrote:

>  2. Describe a way to dynamically adapt to the mess, and have driver
> authors implement that. 
> Regarding 2.: It's possible to hasattr(contenthandler, 'startElement')
> and we should use that; i.e. if the handler does not fit to our feature 
> setting, adapt to the handler.

I don't agree. It's not the job of the framework library to adapt itself
to the user code. This will lead to generations of broken ContentHandlers. 

> This can be further improved by remembering whether someone changed our 
> default feature setting, and only adapt in the default case. Else, a
> MEANINGFUL exception is raised (i.e. not "startElement was called with
> 3 args ... bleh", but "you set feature namespaces to true, and your
> handler does not reflect that").

Now this is something I like. Inform the user precisely of what the
problem is and let him fix his code. 

Alexandre Fayolle
-- 
LOGILAB, Paris (France).
http://www.logilab.com   http://www.logilab.fr  http://www.logilab.org
Narval, the first software agent available as free software (GPL).