Fix song import duplication by removing training space on the search title.

Fixed up all locations field was made and the reindex code.
Only tested with reindex!

Fixes: https://launchpad.net/bugs/712252
This commit is contained in:
Tim Bentley 2011-03-06 16:28:26 +00:00
parent 094e7968d0
commit 6ef78ef39d
6 changed files with 6 additions and 5 deletions

View File

@ -810,4 +810,4 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
# This method must only be run after the self.song = Song() assignment.
log.debug(u'processTitle')
self.song.search_title = re.sub(r'[\'"`,;:(){}?]+', u'',
unicode(self.song.search_title)).lower()
unicode(self.song.search_title)).lower().strip()

View File

@ -540,7 +540,7 @@ class FoilPresenter(object):
song.alternate_title = self._child(titelstring)
song.search_title += u'@' + song.alternate_title
song.search_title = re.sub(r'[\'"`,;:(){}?]+', u'',
unicode(song.search_title)).lower()
unicode(song.search_title)).lower().strip()
def _process_topics(self, foilpresenterfolie, song):
"""

View File

@ -167,7 +167,7 @@ class OpenLPSongImport(SongImport):
new_song.alternate_title = old_titles[1]
else:
new_song.alternate_title = u''
new_song.search_title = song.search_title
new_song.search_title = song.search_title.strip()
new_song.song_number = song.song_number
new_song.lyrics = song.lyrics
new_song.search_lyrics = song.search_lyrics

View File

@ -276,6 +276,7 @@ class SongImport(QtCore.QObject):
song.alternate_title = self.alternate_title
song.search_title = self.remove_punctuation(self.title).lower() \
+ '@' + self.remove_punctuation(self.alternate_title).lower()
song.search_title = song.search_title.strip()
song.song_number = self.song_number
song.search_lyrics = u''
verses_changed_to_other = {}

View File

@ -536,7 +536,7 @@ class OpenLyrics(object):
song.alternate_title = self._text(title)
song.search_title += u'@' + song.alternate_title
song.search_title = re.sub(r'[\'"`,;:(){}?]+', u'',
unicode(song.search_title)).lower()
unicode(song.search_title)).lower().strip()
def _process_topics(self, properties, song):
"""

View File

@ -154,7 +154,7 @@ class SongsPlugin(Plugin):
if song.alternate_title is None:
song.alternate_title = u''
song.search_title = self.whitespace.sub(u' ', song.title.lower() +
u' ' + song.alternate_title.lower())
u' ' + song.alternate_title.lower()).strip()
# Remove the "language" attribute from lyrics tag. This is not very
# important, but this keeps the database clean. This can be removed
# when everybody has run the reindex tool once.