[XML-SIG] Reconsidering NamespaceErr on '' and None

Sylvain Thenault Sylvain.Thenault@logilab.fr
Fri, 14 Dec 2001 17:37:01 +0100 (CET)


On Fri, 14 Dec 2001, Fred L. Drake, Jr. wrote:

> 
> Rich Salz writes:
>  > If PyXML 0.7 silently converts '' to None, then I can go back to
>  >   _find_attr = lambda E, attr: E.getAttributeNS(None, attr) or \
>  > 	E.getAttributeNS('', attr)
>  > which has a performance hit if the attribute is not found.
> 
>   Here's an idea: the exception should be raised when attempting to
> set an attribute with a namespace URI of '', but queries could allow
> either:
> 
>     def getAttributeNS(self, namespaceURI, localName):
>         namespaceURI = namespaceURI or None
>         ...
> 
>   This isn't perfect, but would probably avoid most problems with
> client code that uses ''.

that sounds good to me

regards

-- 
Sylvain Thenault

  LOGILAB           http://www.logilab.org