On 9/28/05, Mike Coleman <[EMAIL PROTECTED]> wrote:
>
> On 9/28/05, Kevin Dangoor <[EMAIL PROTECTED]> wrote:
> > While I agree that some kind of helper might be nice, why can't the
> > command-line front end set the config variable before the model is
> > imported?
>
> Because having to set a variable before importing a module is yucky.  :-)
>
> Seriously, I think requiring this sort of dynamic, eval-like behavior will
> probably raise hell with future tools that would compile or analyze this
> code.  Plus it makes the code harder to understand.
>
> I can't quite tell from the documentation whether SQLObject itself also has
> this problem.  It does seem natural, though, to want to have a simple way to
> set the database URI before we start processing, without requiring a secret
> handshake.

I just checked in a change that will hopefully make life better.
You'll need to use the new PackageHub instead of the AutoConnectHub.

If you do so, you can call
turbogears.database.set_db_uri("some://uri")

which is possibly more pleasant than setting the config variables in
the scripts. The PackageHub does not look up the dburi until the
connection is used, so that should hopefully help with any import
timing issues...

Kevin

Reply via email to