Merge lp:~raoul-snyman/openlp/bug-863845 into lp:openlp

Proposed by Raoul Snyman
Status: Merged
Approved by: Tim Bentley
Approved revision: 1822
Merged at revision: 1823
Proposed branch: lp:~raoul-snyman/openlp/bug-863845
Merge into: lp:openlp
Diff against target: 105 lines (+37/-37)
1 file modified
openlp/plugins/songs/lib/olpimport.py (+37/-37)
To merge this branch: bzr merge lp:~raoul-snyman/openlp/bug-863845
Reviewer Review Type Date Requested Status
Andreas Preikschat (community) Approve
Tim Bentley Approve
Review via email: mp+84408@code.launchpad.net

Commit message

Fixed a minor bug where if you imported 2 OpenLP 2.0 databases in the same OpenLP session whose schemas were different, you'd get an error about missing columns or tables.

Description of the change

Fixed a minor bug where if you imported 2 OpenLP 2.0 databases in the same OpenLP session whose schemas were different, you'd get an error about missing columns or tables.

To post a comment you must log in.
Revision history for this message
Tim Bentley (trb143) :
review: Approve
Revision history for this message
Andreas Preikschat (googol-deactivatedaccount) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openlp/plugins/songs/lib/olpimport.py'
--- openlp/plugins/songs/lib/olpimport.py 2011-12-04 13:26:27 +0000
+++ openlp/plugins/songs/lib/olpimport.py 2011-12-04 21:08:25 +0000
@@ -30,7 +30,7 @@
30"""30"""
31import logging31import logging
3232
33from sqlalchemy import create_engine, MetaData33from sqlalchemy import create_engine, MetaData, Table
34from sqlalchemy.orm import class_mapper, mapper, relation, scoped_session, \34from sqlalchemy.orm import class_mapper, mapper, relation, scoped_session, \
35 sessionmaker35 sessionmaker
36from sqlalchemy.orm.exc import UnmappedClassError36from sqlalchemy.orm.exc import UnmappedClassError
@@ -44,41 +44,6 @@
4444
45log = logging.getLogger(__name__)45log = logging.getLogger(__name__)
4646
47class OldAuthor(BaseModel):
48 """
49 Author model
50 """
51 pass
52
53
54class OldBook(BaseModel):
55 """
56 Book model
57 """
58 pass
59
60
61class OldMediaFile(BaseModel):
62 """
63 MediaFile model
64 """
65 pass
66
67
68class OldSong(BaseModel):
69 """
70 Song model
71 """
72 pass
73
74
75class OldTopic(BaseModel):
76 """
77 Topic model
78 """
79 pass
80
81
82class OpenLPSongImport(SongImport):47class OpenLPSongImport(SongImport):
83 """48 """
84 The :class:`OpenLPSongImport` class provides OpenLP with the ability to49 The :class:`OpenLPSongImport` class provides OpenLP with the ability to
@@ -101,6 +66,41 @@
101 """66 """
102 Run the import for an OpenLP version 2 song database.67 Run the import for an OpenLP version 2 song database.
103 """68 """
69 class OldAuthor(BaseModel):
70 """
71 Author model
72 """
73 pass
74
75
76 class OldBook(BaseModel):
77 """
78 Book model
79 """
80 pass
81
82
83 class OldMediaFile(BaseModel):
84 """
85 MediaFile model
86 """
87 pass
88
89
90 class OldSong(BaseModel):
91 """
92 Song model
93 """
94 pass
95
96
97 class OldTopic(BaseModel):
98 """
99 Topic model
100 """
101 pass
102
103
104 if not self.importSource.endswith(u'.sqlite'):104 if not self.importSource.endswith(u'.sqlite'):
105 self.logError(self.importSource,105 self.logError(self.importSource,
106 translate('SongsPlugin.OpenLPSongImport',106 translate('SongsPlugin.OpenLPSongImport',
@@ -138,7 +138,7 @@
138 secondary=source_songs_topics_table)138 secondary=source_songs_topics_table)
139 }139 }
140 if has_media_files:140 if has_media_files:
141 if source_media_files_songs_table is not None:141 if isinstance(source_media_files_songs_table, Table):
142 song_props['media_files'] = relation(OldMediaFile,142 song_props['media_files'] = relation(OldMediaFile,
143 backref='songs',143 backref='songs',
144 secondary=source_media_files_songs_table)144 secondary=source_media_files_songs_table)