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
1=== modified file 'openlp/plugins/songs/lib/olpimport.py'
2--- openlp/plugins/songs/lib/olpimport.py 2011-12-04 13:26:27 +0000
3+++ openlp/plugins/songs/lib/olpimport.py 2011-12-04 21:08:25 +0000
4@@ -30,7 +30,7 @@
5 """
6 import logging
7
8-from sqlalchemy import create_engine, MetaData
9+from sqlalchemy import create_engine, MetaData, Table
10 from sqlalchemy.orm import class_mapper, mapper, relation, scoped_session, \
11 sessionmaker
12 from sqlalchemy.orm.exc import UnmappedClassError
13@@ -44,41 +44,6 @@
14
15 log = logging.getLogger(__name__)
16
17-class OldAuthor(BaseModel):
18- """
19- Author model
20- """
21- pass
22-
23-
24-class OldBook(BaseModel):
25- """
26- Book model
27- """
28- pass
29-
30-
31-class OldMediaFile(BaseModel):
32- """
33- MediaFile model
34- """
35- pass
36-
37-
38-class OldSong(BaseModel):
39- """
40- Song model
41- """
42- pass
43-
44-
45-class OldTopic(BaseModel):
46- """
47- Topic model
48- """
49- pass
50-
51-
52 class OpenLPSongImport(SongImport):
53 """
54 The :class:`OpenLPSongImport` class provides OpenLP with the ability to
55@@ -101,6 +66,41 @@
56 """
57 Run the import for an OpenLP version 2 song database.
58 """
59+ class OldAuthor(BaseModel):
60+ """
61+ Author model
62+ """
63+ pass
64+
65+
66+ class OldBook(BaseModel):
67+ """
68+ Book model
69+ """
70+ pass
71+
72+
73+ class OldMediaFile(BaseModel):
74+ """
75+ MediaFile model
76+ """
77+ pass
78+
79+
80+ class OldSong(BaseModel):
81+ """
82+ Song model
83+ """
84+ pass
85+
86+
87+ class OldTopic(BaseModel):
88+ """
89+ Topic model
90+ """
91+ pass
92+
93+
94 if not self.importSource.endswith(u'.sqlite'):
95 self.logError(self.importSource,
96 translate('SongsPlugin.OpenLPSongImport',
97@@ -138,7 +138,7 @@
98 secondary=source_songs_topics_table)
99 }
100 if has_media_files:
101- if source_media_files_songs_table is not None:
102+ if isinstance(source_media_files_songs_table, Table):
103 song_props['media_files'] = relation(OldMediaFile,
104 backref='songs',
105 secondary=source_media_files_songs_table)