Remove some error handling from the Unicode parser. This makes it more like the rest of glifLib. This kind of wrapping might be useful, but it should be done consistently.

git-svn-id: http://svn.robofab.com/trunk@238 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
This commit is contained in:
Tal Leming 2011-04-28 14:22:09 +00:00
parent 2faf5dc355
commit 2a57ef7b10

View File

@ -575,12 +575,7 @@ class _FetchUnicodesParser(object):
def startElementHandler(self, name, attrs): def startElementHandler(self, name, attrs):
if name == "unicode" and len(self._elementStack) == 1 and self._elementStack[0] == "glyph": if name == "unicode" and len(self._elementStack) == 1 and self._elementStack[0] == "glyph":
value = attrs.get("hex") value = attrs.get("hex")
if value is None:
raise GlifLibError("The required hex attribute not defined in a unicode element.")
try:
value = int(value, 16) value = int(value, 16)
except ValueError:
raise GlifLibError("The value for the hex attribute defined in a unicode element is not a valid value.")
self.unicodes.append(value) self.unicodes.append(value)
self._elementStack.append(name) self._elementStack.append(name)