[XML-SIG] [ pyxml-Bugs-1616923 ] AttributesImpl does not implement __contains__ on Linux

SourceForge.net noreply at sourceforge.net
Sat Dec 16 12:05:34 CET 2006


Bugs item #1616923, was opened at 2006-12-16 11:05
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=106473&aid=1616923&group_id=6473

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Georg Brandl (gbrandl)
Assigned to: Nobody/Anonymous (nobody)
Summary: AttributesImpl does not implement __contains__ on Linux

Initial Comment:
I'm just forwarding this from the Python tracker
(https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1614387&group_id=5470)

"""
Hi there

Had an odd error trying to run a utility called SVGMath:

File "/home/jason/downloads/SVGMath-0.3.1/svgmath/mathconfig.py", line 54, in startElement
elif u"afm" in attributes:
File "/usr/lib/python2.5/site-packages/_xmlplus/sax/xmlreader.py", line 316, in __getitem__
return self._attrs[name]
KeyError: 0


It appears that AttributesImpl in the sax package (xmlreader.py) doesn't implement __contains__, so the 'in' operator throws an error. This is on Kubuntu/Linux, so I'm not sure if it's distro-specific or all Linux versions of Python.

In any case, if you add:

def __contains__(self, name):
return self._attrs.has_key(name)

to AttributesImpl in xmlreader.py (as per the Windows version of Python), the problem goes away.

Kind regards
Jason
"""

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=106473&aid=1616923&group_id=6473


More information about the XML-SIG mailing list