openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #13066
[Merge] lp:~raoul-snyman/openlp/bug-863845 into lp:openlp
Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/bug-863845 into lp:openlp.
Requested reviews:
Andreas Preikschat (googol)
Jon Tibble (meths)
Tim Bentley (trb143)
Related bugs:
Bug #899532 in OpenLP: "OpenLP 2 database import fails when using an old database"
https://bugs.launchpad.net/openlp/+bug/899532
For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/bug-863845/+merge/84388
Fix various OpenLP 2 import problems. This fixes bugs #863845 and #899532.
--
https://code.launchpad.net/~raoul-snyman/openlp/bug-863845/+merge/84388
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/plugins/songs/lib/olpimport.py'
--- openlp/plugins/songs/lib/olpimport.py 2011-12-02 20:17:57 +0000
+++ openlp/plugins/songs/lib/olpimport.py 2011-12-03 22:40:29 +0000
@@ -39,7 +39,7 @@
from openlp.core.lib.db import BaseModel
from openlp.core.ui.wizard import WizardStrings
from openlp.plugins.songs.lib import clean_song
-from openlp.plugins.songs.lib.db import Author, Book, MediaFile, Song, Topic
+from openlp.plugins.songs.lib.db import Author, Book, Song, Topic, MediaFile
from songimport import SongImport
log = logging.getLogger(__name__)
@@ -121,6 +121,7 @@
source_topics_table = source_meta.tables[u'topics']
source_authors_songs_table = source_meta.tables[u'authors_songs']
source_songs_topics_table = source_meta.tables[u'songs_topics']
+ source_media_files_songs_table = None
if has_media_files:
source_media_files_table = source_meta.tables[u'media_files']
source_media_files_songs_table = \
@@ -137,13 +138,15 @@
secondary=source_songs_topics_table)
}
if has_media_files:
- if source_media_files_songs_table:
+ if source_media_files_songs_table is not None:
song_props['media_files'] = relation(OldMediaFile,
backref='songs',
secondary=source_media_files_songs_table)
else:
song_props['media_files'] = relation(OldMediaFile,
- backref='songs')
+ backref='songs',
+ primaryjoin=source_songs_table.c.id == \
+ source_media_files_table.c.song_id)
try:
class_mapper(OldAuthor)
except UnmappedClassError:
Follow ups