diff --git a/openlp/core/lib/db.py b/openlp/core/lib/db.py index a60521218..f20f3ab38 100644 --- a/openlp/core/lib/db.py +++ b/openlp/core/lib/db.py @@ -188,9 +188,10 @@ class Manager(object): ``order_by_ref`` Any parameters to order the returned objects by. Defaults to None. """ + query = self.session.query(object_class) if order_by_ref: - return self.session.query(object_class).order_by(order_by_ref).all() - return self.session.query(object_class).all() + return query.order_by(order_by_ref).all() + return query.all() def get_all_objects_filtered(self, object_class, filter_clause, order_by_ref=None): @@ -206,10 +207,10 @@ class Manager(object): ``order_by_ref`` Any parameters to order the returned objects by. Defaults to None. """ + query = self.session.query(object_class).filter(filter_clause) if order_by_ref: - return self.session.query(object_class).filter(filter_clause) \ - .order_by(order_by_ref).all() - return self.session.query(object_class).filter(filter_clause).all() + return query.order_by(order_by_ref).all() + return query.all() def delete_object(self, object_class, key): """ diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index 3567ff3a1..e2740748b 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -31,7 +31,7 @@ from openlp.core.lib import Plugin, build_icon, PluginStatus, Receiver, \ translate from openlp.core.lib.db import Manager from openlp.plugins.songs.lib import SongMediaItem, SongsTab -from openlp.plugins.songs.lib.db import Song +from openlp.plugins.songs.lib.db import init_schema, Song try: from openlp.plugins.songs.lib import SofImport, OooImport