Hi List:
 
I was wondering if it is possible to use automatic class generation (http://sqlobject.sourceforge.net/docs/SQLObject.html#automatic-class-generation) and pass a database connection object in at the time of instance creation.  I was thinking something along the lines of:
 
from objects import Trial
u = Trial.new(_connection=req.conn, userName="WUMPUS")
content = u.userName
 
where Trial is:
from SQLObject import *
class Trial(SQLObject):
    _fromDatabase = True
 
 When I try this I'm getting an error indicating that there is no connection object yet:
 
File "/<path>/SQLObject.py", line 523, in addColumnsFromDatabase
    for columnDef in cls._connection.columnsFromSchema(cls._table, cls):
AttributeError: 'NoneType' object has no attribute 'columnsFromSchema'
 
If I set Trial to:
from SQLObject import *
class Trial(SQLObject):
    userName = StringCol()
 
every thing seems to work ok, so I don't think its a problem with the connection.  It does take automatic class generation out of the picture though.  Maybe something to do with the order things are initialized?  I suppose that ultimately I should define my classes manually, so maybe its no big deal.
 
Also, I noticed that SQLObject.new() method accepts the connection as a keyword argument, but the standard constructor will only accept it as the second argument?  i.e. u = Trial(1, req.conn)  Is there a more consistent way to pass the connection to various creation methods?
 
Thanks in advance...
 
-Charles