From bb34a304a9be75c43e02f3cc3768259e536894ca Mon Sep 17 00:00:00 2001 From: Martin Thompson Date: Thu, 15 Jul 2010 21:27:44 +0100 Subject: [PATCH] Tweaked Topics handler --- openlp/plugins/songs/lib/songimport.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/openlp/plugins/songs/lib/songimport.py b/openlp/plugins/songs/lib/songimport.py index 893def7f0..e5045a5f5 100644 --- a/openlp/plugins/songs/lib/songimport.py +++ b/openlp/plugins/songs/lib/songimport.py @@ -190,8 +190,8 @@ class SongImport(object): """ Add the author. OpenLP stores them individually so split by 'and', '&' and comma. - However need to check for "Mr and Mrs Smith" and turn it to - "Mr Smith" and "Mrs Smith". + However need to check for 'Mr and Mrs Smith' and turn it to + 'Mr Smith' and 'Mrs Smith'. """ for author in text.split(u','): authors = author.split(u'&') @@ -325,12 +325,14 @@ class SongImport(object): self.manager.save_object(song_book) song.song_book_id = song_book.id for topictext in self.topics: - topic = self.manager.get_object_filtered(Topic.name == topictext) + if len(topictext) == 0: + continue + topic = self.manager.get_object_filtered(Topic, Topic.name == topictext) if topic is None: topic = Topic() topic.name = topictext self.manager.save_object(topic) - song.topics.append(topictext) + song.topics.append(topic) self.manager.save_object(song) def print_song(self):