From dffee7fbc159e8ce776aec02ec1370af8f9bb45a Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Wed, 2 Apr 2014 09:03:53 +0200 Subject: [PATCH] Restore setting a default author --- openlp/plugins/songs/lib/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/openlp/plugins/songs/lib/__init__.py b/openlp/plugins/songs/lib/__init__.py index 60e8788c8..aa9fbc4c9 100644 --- a/openlp/plugins/songs/lib/__init__.py +++ b/openlp/plugins/songs/lib/__init__.py @@ -389,6 +389,13 @@ def clean_song(manager, song): song.lyrics = str(song.lyrics, encoding='utf8') verses = SongXML().get_verses(song.lyrics) song.search_lyrics = ' '.join([clean_string(verse[1]) for verse in verses]) + # The song does not have any author, add one. + if not song.authors and not song.authors_songs: # Need to check both relations + name = SongStrings.AuthorUnknown + author = manager.get_object_filtered(Author, Author.display_name == name) + if author is None: + author = Author.populate(display_name=name, last_name='', first_name='') + song.authors.append(author) if song.copyright: song.copyright = CONTROL_CHARS.sub('', song.copyright).strip()