← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~m2j/openlp/smallfix into lp:openlp

 

m2j has proposed merging lp:~m2j/openlp/smallfix into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)


Fix: wrong variable names caused osis and http bible imports to crash
Fix: handle unicode in song search string generation
Fix: replaced tab indentation
regenerate search_lyrics on song reindex action
-- 
https://code.launchpad.net/~m2j/openlp/smallfix/+merge/43946
Your team OpenLP Core is requested to review the proposed merge of lp:~m2j/openlp/smallfix into lp:openlp.
=== modified file 'openlp/core/ui/exceptionform.py'
--- openlp/core/ui/exceptionform.py	2010-12-13 14:24:16 +0000
+++ openlp/core/ui/exceptionform.py	2010-12-16 18:34:09 +0000
@@ -138,6 +138,6 @@
             if re.search(r'[/\\]openlp[/\\]', line):
                 source = re.sub(r'.*[/\\]openlp[/\\](.*)".*', r'\1', line)
             if u':' in line:
-            	exception = line.split(u'\n')[-1].split(u':')[0]
+                exception = line.split(u'\n')[-1].split(u':')[0]
         subject = u'Bug report: %s in %s' % (exception, source)
         mailto(address=u'bugs@xxxxxxxxxx', subject=subject, body=body % content)

=== modified file 'openlp/plugins/bibles/lib/http.py'
--- openlp/plugins/bibles/lib/http.py	2010-12-06 19:30:04 +0000
+++ openlp/plugins/bibles/lib/http.py	2010-12-16 18:34:09 +0000
@@ -350,7 +350,7 @@
         Run the import. This method overrides the parent class method. Returns
         ``True`` on success, ``False`` on failure.
         """
-        self.wizard.ImportProgressBar.setMaximum(2)
+        self.wizard.importProgressBar.setMaximum(2)
         self.wizard.incrementProgressBar('Registering bible...')
         self.create_meta(u'download source', self.download_source)
         self.create_meta(u'download name', self.download_name)

=== modified file 'openlp/plugins/bibles/lib/osis.py'
--- openlp/plugins/bibles/lib/osis.py	2010-12-06 19:30:04 +0000
+++ openlp/plugins/bibles/lib/osis.py	2010-12-16 18:34:09 +0000
@@ -134,9 +134,9 @@
                             testament)
                     if last_chapter == 0:
                         if book == u'Gen':
-                            self.wizard.ImportProgressBar.setMaximum(1188)
+                            self.wizard.importProgressBar.setMaximum(1188)
                         else:
-                            self.wizard.ImportProgressBar.setMaximum(260)
+                            self.wizard.importProgressBar.setMaximum(260)
                     if last_chapter != chapter:
                         if last_chapter != 0:
                             self.session.commit()

=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py	2010-12-12 08:35:02 +0000
+++ openlp/plugins/songs/forms/editsongform.py	2010-12-16 18:34:09 +0000
@@ -108,6 +108,7 @@
         self.TopicsListView.setSortingEnabled(False)
         self.TopicsListView.setAlternatingRowColors(True)
         self.findVerseSplit = re.compile(u'---\[\]---\n', re.UNICODE)
+        self.whitespace = re.compile(r'\W+', re.UNICODE)
 
     def initialise(self):
         self.VerseEditButton.setEnabled(False)
@@ -738,7 +739,7 @@
                 verseId = unicode(item.data(QtCore.Qt.UserRole).toString())
                 bits = verseId.split(u':')
                 sxml.add_verse_to_lyrics(bits[0], bits[1], unicode(item.text()))
-                text = text + re.sub(r'\W+', u' ',
+                text = text + whitespace.sub(u' ',
                     unicode(self.VerseListWidget.item(i, 0).text())) + u' '
                 if (bits[1] > u'1') and (bits[0][0] not in multiple):
                     multiple.append(bits[0][0])

=== modified file 'openlp/plugins/songs/lib/songimport.py'
--- openlp/plugins/songs/lib/songimport.py	2010-11-26 14:23:48 +0000
+++ openlp/plugins/songs/lib/songimport.py	2010-12-16 18:34:09 +0000
@@ -247,7 +247,7 @@
         """
         Extracts alphanumeric words for searchable fields
         """
-        return re.sub(r'\W+', u' ', text)
+        return re.sub(r'\W+', u' ', text, re.UNICODE)
 
     def finish(self):
         """

=== modified file 'openlp/plugins/songs/songsplugin.py'
--- openlp/plugins/songs/songsplugin.py	2010-12-09 13:30:23 +0000
+++ openlp/plugins/songs/songsplugin.py	2010-12-16 18:34:09 +0000
@@ -31,7 +31,7 @@
 
 from openlp.core.lib import Plugin, StringContent, build_icon, translate
 from openlp.core.lib.db import Manager
-from openlp.plugins.songs.lib import SongMediaItem, SongsTab
+from openlp.plugins.songs.lib import SongMediaItem, SongsTab, SongXMLParser
 from openlp.plugins.songs.lib.db import init_schema, Song
 from openlp.plugins.songs.lib.importer import SongFormat
 
@@ -150,9 +150,13 @@
                 song.title = u''
             if song.alternate_title is None:
                 song.alternate_title = u''
-            song.search_title = self.whitespace.sub(u' ', \
-                song.title.lower()) + u' ' + \
-                self.whitespace.sub(u' ', song.alternate_title.lower())
+            song.search_title = self.whitespace.sub(u' ', song.title.lower() + \
+                u' ' + song.alternate_title.lower())
+            lyrics = u''
+            verses = SongXMLParser(song.lyrics).get_verses()
+            for verse in verses:
+                lyrics = lyrics + self.whitespace.sub(u' ', verse[1]) + u' '
+            song.search_lyrics = lyrics.lower()
             progressDialog.setValue(counter)
         self.manager.save_objects(songs)
         counter += 1


Follow ups