Optimize code

This commit is contained in:
croneter 2018-10-14 11:47:33 +02:00
parent 8199c2ce5b
commit c5e1d7a7df

View file

@ -678,7 +678,7 @@ class XmlKodiSetting(object):
if self.force_create is False:
LOG.debug('%s does not seem to exist; not creating', self.path)
# This will abort __enter__
self.__exit__(IOError, None, None)
raise IOError
# Create topmost xml entry
self.tree = etree.ElementTree(
element=etree.Element(self.top_element))
@ -690,7 +690,7 @@ class XmlKodiSetting(object):
messageDialog(lang(29999), lang(39716).format(
self.filename,
'http://kodi.wiki'))
self.__exit__(etree.ParseError, None, None)
raise etree.ParseError
self.root = self.tree.getroot()
return self