Merge lp:~sam92/openlp/bug-1326664-2.0 into lp:openlp/2.0

Proposed by Samuel Mehrbrodt
Status: Superseded
Proposed branch: lp:~sam92/openlp/bug-1326664-2.0
Merge into: lp:openlp/2.0
Diff against target: 50 lines (+17/-3)
1 file modified
openlp/plugins/songs/lib/ewimport.py (+17/-3)
To merge this branch: bzr merge lp:~sam92/openlp/bug-1326664-2.0
Reviewer Review Type Date Requested Status
Raoul Snyman Needs Fixing
Review via email: mp+222473@code.launchpad.net

This proposal has been superseded by a proposal from 2014-06-11.

Description of the change

Add proper error messages to EasyWorship import.
Also make sure that Songs.db (lowercase ending) is also being recognized.

To post a comment you must log in.
Revision history for this message
Raoul Snyman (raoul-snyman) :
review: Needs Fixing
Revision history for this message
Raoul Snyman (raoul-snyman) :
Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

<samuel_m> superfly, concerning https://code.launchpad.net/~sam92/openlp/bug-1326664-2.0/+merge/222473 : The log is presented to the user with first the file name and then the error message. So it doesn't make much sense to include the filename in the error message.

review: Approve
Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

Sorry to go back on my approval, could you just change the "This file is not a valid EasyWorship database." strings please?

review: Needs Fixing
lp:~sam92/openlp/bug-1326664-2.0 updated
2197. By Samuel Mehrbrodt

Better wording, indentation

2198. By Samuel Mehrbrodt

Fixes

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/plugins/songs/lib/ewimport.py'
2--- openlp/plugins/songs/lib/ewimport.py 2014-05-20 16:19:06 +0000
3+++ openlp/plugins/songs/lib/ewimport.py 2014-06-11 05:26:38 +0000
4@@ -64,13 +64,23 @@
5
6 def doImport(self):
7 # Open the DB and MB files if they exist
8- import_source_mb = self.importSource.replace('.DB', '.MB')
9+ import_source_mb = self.importSource.replace('.DB', '.MB').replace('.db', '.mb')
10 if not os.path.isfile(self.importSource):
11+ self.logError(self.importSource, translate(
12+ 'SongsPlugin.EasyWorshipSongImport',
13+ 'This file does not exist.'))
14 return
15 if not os.path.isfile(import_source_mb):
16+ self.logError(self.importSource, translate(
17+ 'SongsPlugin.EasyWorshipSongImport',
18+ 'Could not find the "Songs.MB" file. It must be in the same '
19+ 'folder as the "Songs.DB" file.'))
20 return
21 db_size = os.path.getsize(self.importSource)
22 if db_size < 0x800:
23+ self.logError(self.importSource, translate(
24+ 'SongsPlugin.EasyWorshipSongImport',
25+ 'This file is not a valid EasyWorship database.'))
26 return
27 db_file = open(self.importSource, 'rb')
28 self.memoFile = open(import_source_mb, 'rb')
29@@ -80,6 +90,9 @@
30 if header_size != 0x800 or block_size < 1 or block_size > 4:
31 db_file.close()
32 self.memoFile.close()
33+ self.logError(self.importSource, translate(
34+ 'SongsPlugin.EasyWorshipSongImport',
35+ 'This file is not a valid EasyWorship database.'))
36 return
37 # Take a stab at how text is encoded
38 self.encoding = u'cp1252'
39@@ -193,8 +206,9 @@
40 result = strip_rtf(words, self.encoding)
41 except UnicodeDecodeError:
42 # The unicode chars in the rtf was not escaped in the expected manner.
43- self.logError(self.title, unicode(translate('SongsPlugin.EasyWorshipSongImport',
44- 'Unexpected data formatting.')))
45+ self.logError(self.title, unicode(translate(
46+ 'SongsPlugin.EasyWorshipSongImport',
47+ 'Unexpected data formatting.')))
48 continue
49 if result is None:
50 return

Subscribers

People subscribed via source and target branches