When raising KeyError, provide the key value that failed.

This commit is contained in:
Fred Drake 2000-12-13 20:48:29 +00:00
parent dd802208a7
commit ec126dab9c
1 changed files with 4 additions and 4 deletions

View File

@ -292,12 +292,12 @@ class AttributesImpl:
def getNameByQName(self, name):
if not self._attrs.has_key(name):
raise KeyError
raise KeyError, name
return name
def getQNameByName(self, name):
if not self._attrs.has_key(name):
raise KeyError
raise KeyError, name
return name
def getNames(self):
@ -347,14 +347,14 @@ class AttributesNSImpl(AttributesImpl):
if qname == name:
return self._attrs[nsname]
raise KeyError
raise KeyError, name
def getNameByQName(self, name):
for (nsname, qname) in self._qnames.items():
if qname == name:
return nsname
raise KeyError
raise KeyError, name
def getQNameByName(self, name):
return self._qnames[name]