forked from openlp/openlp
Make xml parsing of presentation manager files recover if errors are encountered. Fixes bug 1414980.
Fixes: https://launchpad.net/bugs/1414980
This commit is contained in:
parent
6668282fde
commit
8e8228a69a
@ -25,7 +25,7 @@ Presentationmanager song files into the current database.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from lxml import objectify
|
from lxml import objectify, etree
|
||||||
|
|
||||||
from openlp.core.ui.wizard import WizardStrings
|
from openlp.core.ui.wizard import WizardStrings
|
||||||
from .songimport import SongImport
|
from .songimport import SongImport
|
||||||
@ -42,7 +42,8 @@ class PresentationManagerImport(SongImport):
|
|||||||
if self.stop_import_flag:
|
if self.stop_import_flag:
|
||||||
return
|
return
|
||||||
self.import_wizard.increment_progress_bar(WizardStrings.ImportingType % os.path.basename(file_path))
|
self.import_wizard.increment_progress_bar(WizardStrings.ImportingType % os.path.basename(file_path))
|
||||||
root = objectify.parse(open(file_path, 'rb')).getroot()
|
tree = etree.parse(file_path, parser=etree.XMLParser(recover=True))
|
||||||
|
root = objectify.fromstring(etree.tostring(tree))
|
||||||
self.process_song(root)
|
self.process_song(root)
|
||||||
|
|
||||||
def process_song(self, root):
|
def process_song(self, root):
|
||||||
|
Loading…
Reference in New Issue
Block a user