forked from openlp/openlp
Fix redefinition of init_models()
This commit is contained in:
parent
fb1e222422
commit
dcd5b62524
@ -86,13 +86,6 @@ mapper(TTestament, temp_testament_table)
|
||||
mapper(TBook, temp_book_table)
|
||||
mapper(TVerse, temp_verse_table)
|
||||
|
||||
def init_models(url):
|
||||
engine = create_engine(url)
|
||||
metadata.bind = engine
|
||||
session = scoped_session(sessionmaker(autoflush=False,
|
||||
autocommit=False, bind=engine))
|
||||
return session
|
||||
|
||||
class MigrateBibles(object):
|
||||
def __init__(self, display):
|
||||
self.display = display
|
||||
|
@ -87,8 +87,8 @@ class BibleDB(QtCore.QObject):
|
||||
unicode(settings.value(u'db hostname').toString()),
|
||||
unicode(settings.value(u'db database').toString()))
|
||||
settings.endGroup()
|
||||
self.metadata, self.session = init_models(db_url)
|
||||
self.metadata.create_all(checkfirst=True)
|
||||
self.session = init_models(db_url)
|
||||
metadata.create_all(checkfirst=True)
|
||||
if u'file' in kwargs:
|
||||
self.get_name()
|
||||
|
||||
|
@ -73,10 +73,9 @@ class Verse(BaseModel):
|
||||
def init_models(db_url):
|
||||
engine = create_engine(db_url)
|
||||
metadata.bind = engine
|
||||
session = scoped_session(sessionmaker(autoflush=True,
|
||||
autocommit=False,
|
||||
bind=engine))
|
||||
return metadata, session
|
||||
session = scoped_session(sessionmaker(autoflush=True, autocommit=False,
|
||||
bind=engine))
|
||||
return session
|
||||
|
||||
metadata = MetaData()
|
||||
meta_table = Table(u'metadata', metadata,
|
||||
|
Loading…
Reference in New Issue
Block a user