openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #02526
[Merge] lp:~meths/openlp/trivialfixes into lp:openlp
Jon Tibble has proposed merging lp:~meths/openlp/trivialfixes into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Use populate() for DB objects.
(s/topictext/topic/ fix is in Martin's branch)
--
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/30054
Your team OpenLP Core is requested to review the proposed merge of lp:~meths/openlp/trivialfixes into lp:openlp.
=== modified file 'openlp/plugins/songs/lib/songimport.py'
--- openlp/plugins/songs/lib/songimport.py 2010-07-03 17:46:00 +0000
+++ openlp/plugins/songs/lib/songimport.py 2010-07-15 22:56:48 +0000
@@ -303,28 +303,22 @@
author = self.manager.get_object_filtered(Author,
Author.display_name == authortext)
if author is None:
- author = Author()
- author.display_name = authortext
- author.last_name = authortext.split(u' ')[-1]
- author.first_name = u' '.join(authortext.split(u' ')[:-1])
- self.manager.save_object(author)
+ author = Author.populate(display_name = authortext,
+ last_name=authortext.split(u' ')[-1],
+ first_name=u' '.join(authortext.split(u' ')[:-1]))
song.authors.append(author)
if self.song_book_name:
song_book = self.manager.get_object_filtered(Book,
Book.name == self.song_book_name)
if song_book is None:
- song_book = Book()
- song_book.name = self.song_book_name
- song_book.publisher = self.song_book_pub
- self.manager.save_object(song_book)
- song.song_book_id = song_book.id
+ song_book = Book.populate(name=self.song_book_name,
+ publisher=self.song_book_pub)
+ song.book = song_book
for topictext in self.topics:
topic = self.manager.get_object_filtered(Topic,
Topic.name == topictext)
if topic is None:
- topic = Topic()
- topic.name = topictext
- self.manager.save_object(topic)
+ topic = Topic.populate(name=topictext)
song.topics.append(topictext)
self.manager.save_object(song)
Follow ups