openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #24323
Re: [Merge] lp:~alisonken1/openlp/projector-2.1-merge into lp:openlp
On Sat, Oct 4, 2014 at 3:07 PM, Raoul Snyman <raoul@xxxxxxxxxxx> wrote:
> Review: Needs Information
>
> Comment on line 216
<snip>
>> -def init_db(url, auto_flush=True, auto_commit=False):
>> +def init_db(url, auto_flush=True, auto_commit=False, base=None):
>> """
>> Initialise and return the session and metadata for a database
>>
>> :param url: The database to initialise connection with
>> :param auto_flush: Sets the flushing behaviour of the session
>> :param auto_commit: Sets the commit behaviour of the session
>> + :param base: If using declarative, the base class to bind with
>> """
>> engine = create_engine(url, poolclass=NullPool)
>> - metadata = MetaData(bind=engine)
>> + if base is None:
>> + metadata = MetaData(bind=engine)
>> + else:
>> + base.metadata.create_all(engine, checkfirst=True)
>
> Why are you doing a "create_all" here? The normal route doesn't do that here. Also, shouldn't use be binding the engine to the metadata?
>
> base.metadata.bind = engine
>
When using
base.metadata.bind = engine
You get:
File "/home/ken/program/python/openlp-bzr/trunk/openlp/core/lib/db.py",
line 64, in init_db
base.metadata.bind(engine)
TypeError: 'MetaData' object is not callable
One of the differences when using declarative base.
Slackin' since 1993
Slackware Linux (http://www.slackware.com)
--
https://code.launchpad.net/~alisonken1/openlp/projector-2.1-merge/+merge/237112
Your team OpenLP Core is subscribed to branch lp:openlp.
Follow ups
References