← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~phill-ridout/openlp/bug946581 into lp:openlp

 

phill has proposed merging lp:~phill-ridout/openlp/bug946581 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #946581 in OpenLP: "Prevent users from importing the wrong files"
  https://bugs.launchpad.net/openlp/+bug/946581

For more details, see:
https://code.launchpad.net/~phill-ridout/openlp/bug946581/+merge/99180

Fixes bug #946581 "Prevent users from importing the wrong files"
-- 
https://code.launchpad.net/~phill-ridout/openlp/bug946581/+merge/99180
Your team OpenLP Core is requested to review the proposed merge of lp:~phill-ridout/openlp/bug946581 into lp:openlp.
=== modified file 'openlp/plugins/songs/forms/songimportform.py'
--- openlp/plugins/songs/forms/songimportform.py	2011-12-31 14:18:05 +0000
+++ openlp/plugins/songs/forms/songimportform.py	2012-03-24 18:45:25 +0000
@@ -554,7 +554,9 @@
         Get CCLI song database files
         """
         self.getFiles(WizardStrings.OpenTypeFile % WizardStrings.CCLI,
-            self.ccliFileListWidget)
+            self.ccliFileListWidget,  u'%s (*.usr *.txt)'
+            % translate('SongsPlugin.ImportWizardForm',
+            'CCLI SongSelect Files'))
 
     def onCCLIRemoveButtonClicked(self):
         """
@@ -595,15 +597,22 @@
         self.removeSelectedItems(self.genericFileListWidget)
 
     def onEasySlidesBrowseButtonClicked(self):
+        """
+        Get EasyWorship song database file
+        """
         self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.ES,
-            self.easySlidesFilenameEdit)
+            self.easySlidesFilenameEdit, u'%s (*.xml)'
+            % translate('SongsPlugin.ImportWizardForm',
+            'EasySlides XML File'))
 
     def onEWBrowseButtonClicked(self):
         """
         Get EasyWorship song database files
         """
         self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.EW,
-            self.ewFilenameEdit)
+            self.ewFilenameEdit, u'%s (*.db)'
+            % translate('SongsPlugin.ImportWizardForm',
+            'EasyWorship Song Database'))
 
     def onSongBeamerAddButtonClicked(self):
         """

=== modified file 'openlp/plugins/songs/lib/opensongimport.py'
--- openlp/plugins/songs/lib/opensongimport.py	2012-03-04 14:52:09 +0000
+++ openlp/plugins/songs/lib/opensongimport.py	2012-03-24 18:45:25 +0000
@@ -31,6 +31,7 @@
 from lxml import objectify
 from lxml.etree import Error, LxmlError
 
+from openlp.core.lib import translate
 from openlp.plugins.songs.lib import VerseType
 from openlp.plugins.songs.lib.songimport import SongImport
 from openlp.plugins.songs.lib.ui import SongStrings
@@ -128,6 +129,12 @@
             log.exception(u'Error parsing XML')
             return
         root = tree.getroot()
+        if root.tag != u'song':
+            self.logError(file.name, unicode(
+                translate('SongsPlugin.OpenSongImport',
+                ('Invalid OpenSong song file. Missing '
+                    'song tag.'))))
+            return
         fields = dir(root)
         decode = {
             u'copyright': self.addCopyright,


Follow ups