On 4/19/06, Elver Loho <[EMAIL PROTECTED]> wrote:
> I want to have a class that is initialised from the database. I also
> want to put its definition in the same file or include the model just
> once into my program. However, this is impossible as far as I know. Or
> is it?

Here's a workaround:

def init_from_database():
    global Transactions
    class Transactions(SQLObject):
        ...

Then, once you have your database connection, call init_from_database
in that module.

It would be possible to set up SQLObject's metaclass such that
initialization is deferred until the first attempt is made to use the
class. But it doesn't work that way, and I'd imagine there would be
some trickyness involved in making it work like that.

Kevin


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to