← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~phill-ridout/openlp/bug1098075_2.0 into lp:openlp/2.0

 

Phill has proposed merging lp:~phill-ridout/openlp/bug1098075_2.0 into lp:openlp/2.0.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1098075 in OpenLP: "Cancelling character table dialogue in importer causes OpenLP to crash "
  https://bugs.launchpad.net/openlp/+bug/1098075

For more details, see:
https://code.launchpad.net/~phill-ridout/openlp/bug1098075_2.0/+merge/146321

Fixes bug 1098075 by returning None as requested by Raoul. Now for the correct target branch.
-- 
https://code.launchpad.net/~phill-ridout/openlp/bug1098075_2.0/+merge/146321
Your team OpenLP Core is requested to review the proposed merge of lp:~phill-ridout/openlp/bug1098075_2.0 into lp:openlp/2.0.
=== modified file 'openlp/plugins/songs/lib/__init__.py'
--- openlp/plugins/songs/lib/__init__.py	2012-12-30 19:41:24 +0000
+++ openlp/plugins/songs/lib/__init__.py	2013-02-03 20:19:19 +0000
@@ -581,7 +581,10 @@
                     try:
                         encoding, default_encoding = get_encoding(font, 
                             font_table, default_encoding, failed=failed)
-                        out.append(chr(charcode).decode(encoding))
+                        if encoding:
+                            out.append(chr(charcode).decode(encoding))
+                        else:
+                            return None
                     except UnicodeDecodeError:
                         failed = True
                     else:

=== modified file 'openlp/plugins/songs/lib/ewimport.py'
--- openlp/plugins/songs/lib/ewimport.py	2012-12-30 19:41:24 +0000
+++ openlp/plugins/songs/lib/ewimport.py	2013-02-03 20:19:19 +0000
@@ -180,7 +180,10 @@
                         self.addAuthor(author_name.strip())
                 if words:
                     # Format the lyrics
-                    words, self.encoding = strip_rtf(words, self.encoding)
+                    words = strip_rtf(words, self.encoding)
+                    if words is None:
+                        return
+                    words, self.encoding = words
                     verse_type = VerseType.Tags[VerseType.Verse]
                     for verse in SLIDE_BREAK_REGEX.split(words):
                         verse = verse.strip()

=== modified file 'openlp/plugins/songs/lib/songproimport.py'
--- openlp/plugins/songs/lib/songproimport.py	2012-12-30 19:41:24 +0000
+++ openlp/plugins/songs/lib/songproimport.py	2013-02-03 20:19:19 +0000
@@ -109,7 +109,10 @@
             self.finish()
             return
         if u'rtf1' in text:
-            text, self.encoding = strip_rtf(text, self.encoding)
+            text = strip_rtf(text, self.encoding)
+            if text is None:
+                return
+            text, self.encoding = text
             text = text.rstrip()
         if not text:
             return

=== modified file 'openlp/plugins/songs/lib/sundayplusimport.py'
--- openlp/plugins/songs/lib/sundayplusimport.py	2012-12-30 19:41:24 +0000
+++ openlp/plugins/songs/lib/sundayplusimport.py	2013-02-03 20:19:19 +0000
@@ -150,7 +150,10 @@
                             verse_type = HOTKEY_TO_VERSE_TYPE[value]
                     if name == 'rtf':
                         value = self.unescape(value)
-                        verse, self.encoding = strip_rtf(value, self.encoding)
+                        verse = strip_rtf(value, self.encoding)
+                        if verse is None:
+                            return
+                        verse, self.encoding = verse
                         lines = verse.strip().split('\n')
                         # If any line inside any verse contains CCLI or
                         # only Public Domain, we treat this as special data:


Follow ups