parent
a10e3925d5
commit
061dcb77e0
1 changed files with 1 additions and 3 deletions
|
@ -652,9 +652,8 @@ class XmlKodiSetting(object):
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
try:
|
try:
|
||||||
self.tree = defused_etree.parse(self.path)
|
self.tree = defused_etree.parse(self.path)
|
||||||
except (IOError, TypeError):
|
except IOError:
|
||||||
# Document is blank or missing
|
# Document is blank or missing
|
||||||
# OR (TypeError): Fuck-up if file is empty
|
|
||||||
if self.force_create is False:
|
if self.force_create is False:
|
||||||
LOG.debug('%s does not seem to exist; not creating', self.path)
|
LOG.debug('%s does not seem to exist; not creating', self.path)
|
||||||
# This will abort __enter__
|
# This will abort __enter__
|
||||||
|
@ -670,7 +669,6 @@ class XmlKodiSetting(object):
|
||||||
self.filename,
|
self.filename,
|
||||||
'http://kodi.wiki'))
|
'http://kodi.wiki'))
|
||||||
self.__exit__(ParseError('Error parsing XML'), None, None)
|
self.__exit__(ParseError('Error parsing XML'), None, None)
|
||||||
raise ParseError
|
|
||||||
self.root = self.tree.getroot()
|
self.root = self.tree.getroot()
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue