Bug #969282: Remove control characters from song copyright string

This commit is contained in:
M2j 2012-04-02 13:38:22 +02:00
parent 9d3093a99f
commit 1b056a74ec
2 changed files with 15 additions and 13 deletions

View File

@ -193,19 +193,19 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.song = None self.song = None
self.initialise() self.initialise()
self.songTabWidget.setCurrentIndex(0) self.songTabWidget.setCurrentIndex(0)
self.titleEdit.setText(u'') self.titleEdit.clear()
self.alternativeEdit.setText(u'') self.alternativeEdit.clear()
self.copyrightEdit.setText(u'') self.copyrightEdit.clear()
self.verseOrderEdit.setText(u'') self.verseOrderEdit.clear()
self.commentsEdit.setText(u'') self.commentsEdit.clear()
self.CCLNumberEdit.setText(u'') self.CCLNumberEdit.clear()
self.verseListWidget.clear() self.verseListWidget.clear()
self.verseListWidget.setRowCount(0) self.verseListWidget.setRowCount(0)
self.authorsListView.clear() self.authorsListView.clear()
self.topicsListView.clear() self.topicsListView.clear()
self.audioListWidget.clear() self.audioListWidget.clear()
self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason) self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason)
self.songBookNumberEdit.setText(u'') self.songBookNumberEdit.clear()
self.loadAuthors() self.loadAuthors()
self.loadTopics() self.loadTopics()
self.loadBooks() self.loadBooks()
@ -236,7 +236,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
if self.song.alternate_title: if self.song.alternate_title:
self.alternativeEdit.setText(self.song.alternate_title) self.alternativeEdit.setText(self.song.alternate_title)
else: else:
self.alternativeEdit.setText(u'') self.alternativeEdit.clear()
if self.song.song_book_id != 0: if self.song.song_book_id != 0:
book_name = self.manager.get_object(Book, self.song.song_book_id) book_name = self.manager.get_object(Book, self.song.song_book_id)
find_and_set_in_combo_box( find_and_set_in_combo_box(
@ -247,21 +247,21 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
if self.song.copyright: if self.song.copyright:
self.copyrightEdit.setText(self.song.copyright) self.copyrightEdit.setText(self.song.copyright)
else: else:
self.copyrightEdit.setText(u'') self.copyrightEdit.clear()
self.verseListWidget.clear() self.verseListWidget.clear()
self.verseListWidget.setRowCount(0) self.verseListWidget.setRowCount(0)
if self.song.comments: if self.song.comments:
self.commentsEdit.setPlainText(self.song.comments) self.commentsEdit.setPlainText(self.song.comments)
else: else:
self.commentsEdit.setPlainText(u'') self.commentsEdit.clear()
if self.song.ccli_number: if self.song.ccli_number:
self.CCLNumberEdit.setText(self.song.ccli_number) self.CCLNumberEdit.setText(self.song.ccli_number)
else: else:
self.CCLNumberEdit.setText(u'') self.CCLNumberEdit.clear()
if self.song.song_number: if self.song.song_number:
self.songBookNumberEdit.setText(self.song.song_number) self.songBookNumberEdit.setText(self.song.song_number)
else: else:
self.songBookNumberEdit.setText(u'') self.songBookNumberEdit.clear()
# lazy xml migration for now # lazy xml migration for now
self.verseListWidget.clear() self.verseListWidget.clear()
self.verseListWidget.setRowCount(0) self.verseListWidget.setRowCount(0)

View File

@ -326,7 +326,7 @@ def clean_song(manager, song):
# Rebuild the verse order, to convert translated verse tags, which might # Rebuild the verse order, to convert translated verse tags, which might
# have been added prior to 1.9.5. # have been added prior to 1.9.5.
if song.verse_order: if song.verse_order:
order = song.verse_order.strip().split() order = CONTROL_CHARS.sub(u'', song.verse_order).strip().split()
else: else:
order = [] order = []
new_order = [] new_order = []
@ -358,6 +358,8 @@ def clean_song(manager, song):
author = Author.populate( author = Author.populate(
display_name=name, last_name=u'', first_name=u'') display_name=name, last_name=u'', first_name=u'')
song.authors.append(author) song.authors.append(author)
if song.copyright:
song.copyright = CONTROL_CHARS.sub(u'', song.copyright).strip()
from xml import OpenLyrics, SongXML from xml import OpenLyrics, SongXML
from songstab import SongsTab from songstab import SongsTab