← Back to team overview

openlp-core team mailing list archive

[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:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/bug-863845/+merge/84408

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.
-- 
https://code.launchpad.net/~raoul-snyman/openlp/bug-863845/+merge/84408
Your team OpenLP Core is requested to review the proposed merge of lp:~raoul-snyman/openlp/bug-863845 into lp:openlp.
=== 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 @@
 """
 import logging
 
-from sqlalchemy import create_engine, MetaData
+from sqlalchemy import create_engine, MetaData, Table
 from sqlalchemy.orm import class_mapper, mapper, relation, scoped_session, \
     sessionmaker
 from sqlalchemy.orm.exc import UnmappedClassError
@@ -44,41 +44,6 @@
 
 log = logging.getLogger(__name__)
 
-class OldAuthor(BaseModel):
-    """
-    Author model
-    """
-    pass
-
-
-class OldBook(BaseModel):
-    """
-    Book model
-    """
-    pass
-
-
-class OldMediaFile(BaseModel):
-    """
-    MediaFile model
-    """
-    pass
-
-
-class OldSong(BaseModel):
-    """
-    Song model
-    """
-    pass
-
-
-class OldTopic(BaseModel):
-    """
-    Topic model
-    """
-    pass
-
-
 class OpenLPSongImport(SongImport):
     """
     The :class:`OpenLPSongImport` class provides OpenLP with the ability to
@@ -101,6 +66,41 @@
         """
         Run the import for an OpenLP version 2 song database.
         """
+        class OldAuthor(BaseModel):
+            """
+            Author model
+            """
+            pass
+
+
+        class OldBook(BaseModel):
+            """
+            Book model
+            """
+            pass
+
+
+        class OldMediaFile(BaseModel):
+            """
+            MediaFile model
+            """
+            pass
+
+
+        class OldSong(BaseModel):
+            """
+            Song model
+            """
+            pass
+
+
+        class OldTopic(BaseModel):
+            """
+            Topic model
+            """
+            pass
+
+
         if not self.importSource.endswith(u'.sqlite'):
             self.logError(self.importSource,
                 translate('SongsPlugin.OpenLPSongImport',
@@ -138,7 +138,7 @@
             secondary=source_songs_topics_table)
         }
         if has_media_files:
-            if source_media_files_songs_table is not None:
+            if isinstance(source_media_files_songs_table, Table):
                 song_props['media_files'] = relation(OldMediaFile,
                     backref='songs',
                     secondary=source_media_files_songs_table)


Follow ups