From e70ba41373abceb0a143e54e2135ae512cbbc52f Mon Sep 17 00:00:00 2001 From: Gerald Britton Date: Thu, 26 May 2011 09:35:01 -0400 Subject: [PATCH] Add specific error messages if OoO open fails. Use a lambda to avoid repetition --- openlp/plugins/songs/lib/oooimport.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/songs/lib/oooimport.py b/openlp/plugins/songs/lib/oooimport.py index a03a36121..5e4cd25d4 100644 --- a/openlp/plugins/songs/lib/oooimport.py +++ b/openlp/plugins/songs/lib/oooimport.py @@ -71,6 +71,10 @@ class OooImport(SongImport): log.error(exc) return self.import_wizard.progressBar.setMaximum(len(self.import_source)) + error_msg = lambda: self.log_error( + self.filepath, + translate('SongsPlugin.SongImport', + u'Unable to open file')) for filename in self.import_source: if self.stop_import_flag: break @@ -81,9 +85,9 @@ class OooImport(SongImport): self.process_ooo_document() self.close_ooo_file() else: - self.log_error(self.filepath) + error_msg() else: - self.log_error(self.filepath) + error_msg() self.close_ooo() def process_ooo_document(self):