Commit ec126dab authored by Fred Drake's avatar Fred Drake

When raising KeyError, provide the key value that failed.

parent dd802208
...@@ -292,12 +292,12 @@ class AttributesImpl: ...@@ -292,12 +292,12 @@ class AttributesImpl:
def getNameByQName(self, name): def getNameByQName(self, name):
if not self._attrs.has_key(name): if not self._attrs.has_key(name):
raise KeyError raise KeyError, name
return name return name
def getQNameByName(self, name): def getQNameByName(self, name):
if not self._attrs.has_key(name): if not self._attrs.has_key(name):
raise KeyError raise KeyError, name
return name return name
def getNames(self): def getNames(self):
...@@ -347,14 +347,14 @@ class AttributesNSImpl(AttributesImpl): ...@@ -347,14 +347,14 @@ class AttributesNSImpl(AttributesImpl):
if qname == name: if qname == name:
return self._attrs[nsname] return self._attrs[nsname]
raise KeyError raise KeyError, name
def getNameByQName(self, name): def getNameByQName(self, name):
for (nsname, qname) in self._qnames.items(): for (nsname, qname) in self._qnames.items():
if qname == name: if qname == name:
return nsname return nsname
raise KeyError raise KeyError, name
def getQNameByName(self, name): def getQNameByName(self, name):
return self._qnames[name] return self._qnames[name]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment