Merge lp:~mahfiaz/openlp/opensong-bible-importer-crash into lp:openlp

Proposed by mahfiaz
Status: Rejected
Rejected by: Andreas Preikschat
Proposed branch: lp:~mahfiaz/openlp/opensong-bible-importer-crash
Merge into: lp:openlp
Diff against target: 51 lines (+9/-3)
3 files modified
openlp/plugins/bibles/forms/bibleupgradeform.py (+1/-1)
openlp/plugins/bibles/lib/db.py (+1/-1)
openlp/plugins/bibles/lib/opensong.py (+7/-1)
To merge this branch: bzr merge lp:~mahfiaz/openlp/opensong-bible-importer-crash
Reviewer Review Type Date Requested Status
Andreas Preikschat (community) Needs Resubmitting
Tim Bentley Needs Fixing
Review via email: mp+183328@code.launchpad.net

This proposal supersedes a proposal from 2013-08-24.

Description of the change

Fixes traceback when using opensong importer, not working cancel button for any of bible importers and opensong importer not acception XML file which starts with a space.

To post a comment you must log in.
Revision history for this message
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal

Lines 34 and 41 are not needed.

You need to add a test even if it is not connected to the change. Welcome to the 2.2 world!

review: Needs Fixing
Revision history for this message
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal

Please resubmit due to the age of this request and additionally it will need converting to Python 3 as on 1/9/2013 truck will be converted.

review: Needs Resubmitting
Revision history for this message
Tim Bentley (trb143) wrote :

Please resubmit as this is not compatible with python3 as tests are required for all core changes.

review: Needs Fixing
Revision history for this message
Andreas Preikschat (googol-deactivatedaccount) wrote :

Please resubmit by the end of 2013.

review: Needs Resubmitting

Unmerged revisions

2290. By mahfiaz

Remove unnecessary blank lines.

2289. By mahfiaz

Fix Cancel import not working for Bible plugins.

2288. By mahfiaz

Make OpenSong bible importer ignore whitespace in start of XML file.

2287. By mahfiaz

Fix a crash when importing OpenSong bible.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openlp/plugins/bibles/forms/bibleupgradeform.py'
--- openlp/plugins/bibles/forms/bibleupgradeform.py 2013-04-25 17:58:37 +0000
+++ openlp/plugins/bibles/forms/bibleupgradeform.py 2013-08-31 15:20:27 +0000
@@ -82,7 +82,7 @@
82 Set up the UI for the bible wizard.82 Set up the UI for the bible wizard.
83 """83 """
84 OpenLPWizard.setupUi(self, image)84 OpenLPWizard.setupUi(self, image)
85 Registry().execute(u'openlp_stop_wizard', self.stop_import)85 Registry().register_function(u'openlp_stop_wizard', self.stop_import)
8686
87 def stop_import(self):87 def stop_import(self):
88 """88 """
8989
=== modified file 'openlp/plugins/bibles/lib/db.py'
--- openlp/plugins/bibles/lib/db.py 2013-06-24 16:54:23 +0000
+++ openlp/plugins/bibles/lib/db.py 2013-08-31 15:20:27 +0000
@@ -160,7 +160,7 @@
160 if u'path' in kwargs:160 if u'path' in kwargs:
161 self.path = kwargs[u'path']161 self.path = kwargs[u'path']
162 self.wizard = None162 self.wizard = None
163 Registry().execute(u'openlp_stop_wizard', self.stop_import)163 Registry().register_function(u'openlp_stop_wizard', self.stop_import)
164164
165 def stop_import(self):165 def stop_import(self):
166 """166 """
167167
=== modified file 'openlp/plugins/bibles/lib/opensong.py'
--- openlp/plugins/bibles/lib/opensong.py 2013-04-18 17:45:14 +0000
+++ openlp/plugins/bibles/lib/opensong.py 2013-08-31 15:20:27 +0000
@@ -80,6 +80,12 @@
80 # NOTE: We don't need to do any of the normal encoding detection here, because lxml does it's own encoding80 # NOTE: We don't need to do any of the normal encoding detection here, because lxml does it's own encoding
81 # detection, and the two mechanisms together interfere with each other.81 # detection, and the two mechanisms together interfere with each other.
82 file = open(self.filename, u'r')82 file = open(self.filename, u'r')
83 # Seek over any preceeding whitespace.
84 while True:
85 byte = file.read(1)
86 if len(byte.strip()):
87 break
88 file.seek(file.tell() - 1)
83 opensong = objectify.parse(file)89 opensong = objectify.parse(file)
84 bible = opensong.getroot()90 bible = opensong.getroot()
85 language_id = self.get_language(bible_name)91 language_id = self.get_language(bible_name)
@@ -123,7 +129,7 @@
123 verse_number += 1129 verse_number += 1
124 self.create_verse(db_book.id, chapter_number, verse_number, self.get_text(verse))130 self.create_verse(db_book.id, chapter_number, verse_number, self.get_text(verse))
125 self.wizard.increment_progress_bar(translate('BiblesPlugin.Opensong', 'Importing %s %s...',131 self.wizard.increment_progress_bar(translate('BiblesPlugin.Opensong', 'Importing %s %s...',
126 'Importing <book name> <chapter>...')) % (db_book.name, chapter_number)132 'Importing <book name> <chapter>...') % (db_book.name, chapter_number))
127 self.session.commit()133 self.session.commit()
128 self.application.process_events()134 self.application.process_events()
129 except etree.XMLSyntaxError as inst:135 except etree.XMLSyntaxError as inst: