← 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:
  Raoul Snyman (raoul-snyman)
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/146488

Fixes bug 1098075 by returning None as requested by Raoul. Now for the correct target branch.
Changed the return var to result
A little tweak to reduce code
-- 
https://code.launchpad.net/~phill-ridout/openlp/bug1098075_2.0/+merge/146488
Your team OpenLP Core is subscribed to branch 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-04 18:34:22 +0000
@@ -581,6 +581,8 @@
                     try:
                         encoding, default_encoding = get_encoding(font, 
                             font_table, default_encoding, failed=failed)
+                        if not encoding:
+                            return None
                         out.append(chr(charcode).decode(encoding))
                     except UnicodeDecodeError:
                         failed = True

=== 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-04 18:34:22 +0000
@@ -180,7 +180,10 @@
                         self.addAuthor(author_name.strip())
                 if words:
                     # Format the lyrics
-                    words, self.encoding = strip_rtf(words, self.encoding)
+                    result = strip_rtf(words, self.encoding)
+                    if result is None:
+                        return
+                    words, self.encoding = result
                     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-04 18:34:22 +0000
@@ -109,7 +109,10 @@
             self.finish()
             return
         if u'rtf1' in text:
-            text, self.encoding = strip_rtf(text, self.encoding)
+            result = strip_rtf(text, self.encoding)
+            if result is None:
+                return
+            text, self.encoding = result
             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-04 18:34:22 +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)
+                        result = strip_rtf(value, self.encoding)
+                        if result is None:
+                            return
+                        verse, self.encoding = result
                         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