Fix redefinition of init_models()

This commit is contained in:
Jon Tibble 2010-05-29 22:28:40 +01:00
parent fb1e222422
commit dcd5b62524
3 changed files with 5 additions and 13 deletions

View File

@ -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

View File

@ -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()

View File

@ -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,