Caveat: I'm very new to SQLObject, but it has saved me a lot of work already. However I'm tripping over something so basic that I wonder if I've fundamentally misunderstood things. So apologies if this is too simple, but I need a new set of eyes on it.

I'm using SQLObject to connect to a mySQL db from a webservice I've written. Now this service will be pushed out to a number of machines and sites, so the connection details will change. Therefore, I need to set the connection after the class is defined. My understanding is that this is fine, but when I define my class as below::

   import sqlobject
   from sqlobject.mysql import builder

   class Report (sqlobject.SQLObject):
      _connection = None
      class sqlmeta:
         fromDatabase = True

    Report._connection = builder()(user='XXXX', passwd='XXXX', host='localhost', db='XXXX', port=3306)

when the code is imported, the Report class fails with the traceback:

   >>> import rdbconnection
   Traceback (most recent call last):
     File "<stdin>", line 1, in ?
     File "", line 5, in ?
       class Report (sqlobject.SQLObject):
     File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1860-py2.4.egg/sqlobject/", line 109, in __new__
       cls.__classinit__(cls, new_attrs)
     File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1860-py2.4.egg/sqlobject/", line 776, in __classinit__
     File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1860-py2.4.egg/sqlobject/", line 420, in addColumnsFromDatabase
       conn = connection or soClass._connection
     File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1860-py2.4.egg/sqlobject/", line 887, in __get__
       return self.getConnection()
     File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1860-py2.4.egg/sqlobject/", line 899, in getConnection
       raise AttributeError(
   AttributeError: No connection has been defined for this thread or process

which seemingly implies that the connection must be defined in the class. I tinkered with the class definition (giving a false connection or None, etc.) but the behaviour is identical. So what have I missed here?

[Technical details: MacOSX 10.4, SQLObject-0.7.1dev_r1860, python2.4]

While I'm at it, any advice about using SQLObject with Zope? While there is sqlos, it seems like a very industrial approach that maps a db into the Zope database and I just want to make a few queries and write a few records. 

And finally, is the `class sqlmeta` the current and future way of declaring `fromDatabase=True`?



Dr Paul-Michael Agapow, VieDigitale / Institute of Animal Health /