openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #19119
[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/146309
Fixes bug 1098075 by raising an error when the user cancels the code page selection dialog.
I'll fix trunk when/if you ok this
--
https://code.launchpad.net/~phill-ridout/openlp/bug1098075_2.0/+merge/146309
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 17:41:18 +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:
+ raise Exception(u'user_canceled')
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 17:41:18 +0000
@@ -180,7 +180,13 @@
self.addAuthor(author_name.strip())
if words:
# Format the lyrics
- words, self.encoding = strip_rtf(words, self.encoding)
+ try:
+ words, self.encoding = strip_rtf(words, self.encoding)
+ except Exception as info:
+ if unicode(info) == u'user_canceled':
+ return
+ else:
+ raise
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 17:41:18 +0000
@@ -109,8 +109,14 @@
self.finish()
return
if u'rtf1' in text:
- text, self.encoding = strip_rtf(text, self.encoding)
- text = text.rstrip()
+ try:
+ text, self.encoding = strip_rtf(text, self.encoding)
+ text = text.rstrip()
+ except Exception as info:
+ if unicode(info) == u'user_canceled':
+ return
+ else:
+ raise
if not text:
return
if tag == u'A':
=== 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 17:41:18 +0000
@@ -150,8 +150,14 @@
verse_type = HOTKEY_TO_VERSE_TYPE[value]
if name == 'rtf':
value = self.unescape(value)
- verse, self.encoding = strip_rtf(value, self.encoding)
- lines = verse.strip().split('\n')
+ try:
+ verse, self.encoding = strip_rtf(value, self.encoding)
+ lines = verse.strip().split('\n')
+ except Exception as info:
+ if unicode(info) == u'user_canceled':
+ return
+ else:
+ raise
# If any line inside any verse contains CCLI or
# only Public Domain, we treat this as special data:
# we remove that line and add data to specific field.
Follow ups