← Back to team overview

openlp-core team mailing list archive

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

 

mahfiaz has proposed merging lp:~mahfiaz/openlp/opensong-bible-importer-crash into lp:openlp.

Requested reviews:
  Tim Bentley (trb143)

For more details, see:
https://code.launchpad.net/~mahfiaz/openlp/opensong-bible-importer-crash/+merge/183328

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.
-- 
https://code.launchpad.net/~mahfiaz/openlp/opensong-bible-importer-crash/+merge/183328
Your team OpenLP Core is subscribed to branch lp:openlp.
=== 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 @@
         Set up the UI for the bible wizard.
         """
         OpenLPWizard.setupUi(self, image)
-        Registry().execute(u'openlp_stop_wizard', self.stop_import)
+        Registry().register_function(u'openlp_stop_wizard', self.stop_import)
 
     def stop_import(self):
         """

=== 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 @@
         if u'path' in kwargs:
             self.path = kwargs[u'path']
         self.wizard = None
-        Registry().execute(u'openlp_stop_wizard', self.stop_import)
+        Registry().register_function(u'openlp_stop_wizard', self.stop_import)
 
     def stop_import(self):
         """

=== 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 @@
             # NOTE: We don't need to do any of the normal encoding detection here, because lxml does it's own encoding
             # detection, and the two mechanisms together interfere with each other.
             file = open(self.filename, u'r')
+            # Seek over any preceeding whitespace.
+            while True:
+                byte = file.read(1)
+                if len(byte.strip()):
+                    break
+            file.seek(file.tell() - 1)
             opensong = objectify.parse(file)
             bible = opensong.getroot()
             language_id = self.get_language(bible_name)
@@ -123,7 +129,7 @@
                             verse_number += 1
                         self.create_verse(db_book.id, chapter_number, verse_number, self.get_text(verse))
                     self.wizard.increment_progress_bar(translate('BiblesPlugin.Opensong', 'Importing %s %s...',
-                        'Importing <book name> <chapter>...')) % (db_book.name, chapter_number)
+                        'Importing <book name> <chapter>...') % (db_book.name, chapter_number))
                 self.session.commit()
             self.application.process_events()
         except etree.XMLSyntaxError as inst:


Follow ups