forked from openlp/openlp
Fix various OpenLP 2 import problems.
bzr-revno: 1817 Fixes: https://launchpad.net/bugs/863845, https://launchpad.net/bugs/899532
This commit is contained in:
commit
f1c4367127
@ -39,7 +39,7 @@ from openlp.core.lib import translate
|
|||||||
from openlp.core.lib.db import BaseModel
|
from openlp.core.lib.db import BaseModel
|
||||||
from openlp.core.ui.wizard import WizardStrings
|
from openlp.core.ui.wizard import WizardStrings
|
||||||
from openlp.plugins.songs.lib import clean_song
|
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
|
from songimport import SongImport
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -121,6 +121,7 @@ class OpenLPSongImport(SongImport):
|
|||||||
source_topics_table = source_meta.tables[u'topics']
|
source_topics_table = source_meta.tables[u'topics']
|
||||||
source_authors_songs_table = source_meta.tables[u'authors_songs']
|
source_authors_songs_table = source_meta.tables[u'authors_songs']
|
||||||
source_songs_topics_table = source_meta.tables[u'songs_topics']
|
source_songs_topics_table = source_meta.tables[u'songs_topics']
|
||||||
|
source_media_files_songs_table = None
|
||||||
if has_media_files:
|
if has_media_files:
|
||||||
source_media_files_table = source_meta.tables[u'media_files']
|
source_media_files_table = source_meta.tables[u'media_files']
|
||||||
source_media_files_songs_table = \
|
source_media_files_songs_table = \
|
||||||
@ -137,13 +138,15 @@ class OpenLPSongImport(SongImport):
|
|||||||
secondary=source_songs_topics_table)
|
secondary=source_songs_topics_table)
|
||||||
}
|
}
|
||||||
if has_media_files:
|
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,
|
song_props['media_files'] = relation(OldMediaFile,
|
||||||
backref='songs',
|
backref='songs',
|
||||||
secondary=source_media_files_songs_table)
|
secondary=source_media_files_songs_table)
|
||||||
else:
|
else:
|
||||||
song_props['media_files'] = relation(OldMediaFile,
|
song_props['media_files'] = relation(OldMediaFile,
|
||||||
backref='songs')
|
backref='songs',
|
||||||
|
primaryjoin=source_songs_table.c.id == \
|
||||||
|
source_media_files_table.c.song_id)
|
||||||
try:
|
try:
|
||||||
class_mapper(OldAuthor)
|
class_mapper(OldAuthor)
|
||||||
except UnmappedClassError:
|
except UnmappedClassError:
|
||||||
|
Loading…
Reference in New Issue
Block a user