forked from openlp/openlp
DB cleanups
This commit is contained in:
parent
079d72f93f
commit
c61121bb51
@ -188,9 +188,10 @@ class Manager(object):
|
|||||||
``order_by_ref``
|
``order_by_ref``
|
||||||
Any parameters to order the returned objects by. Defaults to None.
|
Any parameters to order the returned objects by. Defaults to None.
|
||||||
"""
|
"""
|
||||||
|
query = self.session.query(object_class)
|
||||||
if order_by_ref:
|
if order_by_ref:
|
||||||
return self.session.query(object_class).order_by(order_by_ref).all()
|
return query.order_by(order_by_ref).all()
|
||||||
return self.session.query(object_class).all()
|
return query.all()
|
||||||
|
|
||||||
def get_all_objects_filtered(self, object_class, filter_clause,
|
def get_all_objects_filtered(self, object_class, filter_clause,
|
||||||
order_by_ref=None):
|
order_by_ref=None):
|
||||||
@ -206,10 +207,10 @@ class Manager(object):
|
|||||||
``order_by_ref``
|
``order_by_ref``
|
||||||
Any parameters to order the returned objects by. Defaults to None.
|
Any parameters to order the returned objects by. Defaults to None.
|
||||||
"""
|
"""
|
||||||
|
query = self.session.query(object_class).filter(filter_clause)
|
||||||
if order_by_ref:
|
if order_by_ref:
|
||||||
return self.session.query(object_class).filter(filter_clause) \
|
return query.order_by(order_by_ref).all()
|
||||||
.order_by(order_by_ref).all()
|
return query.all()
|
||||||
return self.session.query(object_class).filter(filter_clause).all()
|
|
||||||
|
|
||||||
def delete_object(self, object_class, key):
|
def delete_object(self, object_class, key):
|
||||||
"""
|
"""
|
||||||
|
@ -31,7 +31,7 @@ from openlp.core.lib import Plugin, build_icon, PluginStatus, Receiver, \
|
|||||||
translate
|
translate
|
||||||
from openlp.core.lib.db import Manager
|
from openlp.core.lib.db import Manager
|
||||||
from openlp.plugins.songs.lib import SongMediaItem, SongsTab
|
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:
|
try:
|
||||||
from openlp.plugins.songs.lib import SofImport, OooImport
|
from openlp.plugins.songs.lib import SofImport, OooImport
|
||||||
|
Loading…
Reference in New Issue
Block a user