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

Proposed by mahfiaz on 2013-08-31
Status: Rejected
Rejected by: Andreas Preikschat on 2014-03-31
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) Resubmit on 2013-12-19
Tim Bentley 2013-08-31 Needs Fixing on 2013-09-01
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.
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
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: Resubmit
Tim Bentley (trb143) wrote :

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

review: Needs Fixing
Andreas Preikschat (googol) wrote :

Please resubmit by the end of 2013.

review: Resubmit

Unmerged revisions

2290. By mahfiaz on 2013-08-31

Remove unnecessary blank lines.

2289. By mahfiaz on 2013-08-24

Fix Cancel import not working for Bible plugins.

2288. By mahfiaz on 2013-08-24

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

2287. By mahfiaz on 2013-08-24

Fix a crash when importing OpenSong bible.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/plugins/bibles/forms/bibleupgradeform.py'
2--- openlp/plugins/bibles/forms/bibleupgradeform.py 2013-04-25 17:58:37 +0000
3+++ openlp/plugins/bibles/forms/bibleupgradeform.py 2013-08-31 15:20:27 +0000
4@@ -82,7 +82,7 @@
5 Set up the UI for the bible wizard.
6 """
7 OpenLPWizard.setupUi(self, image)
8- Registry().execute(u'openlp_stop_wizard', self.stop_import)
9+ Registry().register_function(u'openlp_stop_wizard', self.stop_import)
10
11 def stop_import(self):
12 """
13
14=== modified file 'openlp/plugins/bibles/lib/db.py'
15--- openlp/plugins/bibles/lib/db.py 2013-06-24 16:54:23 +0000
16+++ openlp/plugins/bibles/lib/db.py 2013-08-31 15:20:27 +0000
17@@ -160,7 +160,7 @@
18 if u'path' in kwargs:
19 self.path = kwargs[u'path']
20 self.wizard = None
21- Registry().execute(u'openlp_stop_wizard', self.stop_import)
22+ Registry().register_function(u'openlp_stop_wizard', self.stop_import)
23
24 def stop_import(self):
25 """
26
27=== modified file 'openlp/plugins/bibles/lib/opensong.py'
28--- openlp/plugins/bibles/lib/opensong.py 2013-04-18 17:45:14 +0000
29+++ openlp/plugins/bibles/lib/opensong.py 2013-08-31 15:20:27 +0000
30@@ -80,6 +80,12 @@
31 # NOTE: We don't need to do any of the normal encoding detection here, because lxml does it's own encoding
32 # detection, and the two mechanisms together interfere with each other.
33 file = open(self.filename, u'r')
34+ # Seek over any preceeding whitespace.
35+ while True:
36+ byte = file.read(1)
37+ if len(byte.strip()):
38+ break
39+ file.seek(file.tell() - 1)
40 opensong = objectify.parse(file)
41 bible = opensong.getroot()
42 language_id = self.get_language(bible_name)
43@@ -123,7 +129,7 @@
44 verse_number += 1
45 self.create_verse(db_book.id, chapter_number, verse_number, self.get_text(verse))
46 self.wizard.increment_progress_bar(translate('BiblesPlugin.Opensong', 'Importing %s %s...',
47- 'Importing <book name> <chapter>...')) % (db_book.name, chapter_number)
48+ 'Importing <book name> <chapter>...') % (db_book.name, chapter_number))
49 self.session.commit()
50 self.application.process_events()
51 except etree.XMLSyntaxError as inst: