First thank you for all your work.
I tested the new version with my projects using SQLObject and
encountered the following problem (is the smallest code that reproduces
the problem).
AttributeError: No connection has been defined for this thread or process
Until at leased version 0.12 this code worked with no problem. I have
not tested the 0.13 version so I don't know if this behaver was yet in
the 0.13 version.
This may be a new Features. If so what do I have to do to get the old
behaviour back where the connection is passed as parameter. I need this
as I access multiple databases for witch the connection is passed to the
corresponding class initialisation or even later during runtime of the
application.
Here the code and the error traceback
#--- Code Begin ---
import sqlobject as sobj
class Person(sobj.SQLObject):
name = sobj.StringCol(default=None)
conn = sobj.connectionForURI('sqlite:/:memory:')
Person.createTable(ifNotExists=True, connection=conn)
Person(name="P. Dummy", connection=conn)
p = Person.selectBy(name = "P. Dummy", connection=conn)
#--- Code End ---
Traceback (most recent call last):
File "D:\eclipse3.6WS\test_python\dbSQLObject_conn_error_small.py",
line 11, in <module>
p = Person.selectBy(name = "P. Dummy", connection=conn)
File
"C:\Python26\lib\site-packages\sqlobject-0.14.0-py2.6.egg\sqlobject\main.py",
line 1377, in selectBy
conn._SO_columnClause(cls, kw),
File
"C:\Python26\lib\site-packages\sqlobject-0.14.0-py2.6.egg\sqlobject\dbconnection.py",
line 585, in _SO_columnClause
value = col.from_python(value, sqlbuilder.SQLObjectState(soClass))
File
"C:\Python26\lib\site-packages\sqlobject-0.14.0-py2.6.egg\sqlobject\col.py",
line 506, in to_python
connection = state.soObject._connection
File
"C:\Python26\lib\site-packages\sqlobject-0.14.0-py2.6.egg\sqlobject\dbconnection.py",
line 837, in __get__
return self.getConnection()
File
"C:\Python26\lib\site-packages\sqlobject-0.14.0-py2.6.egg\sqlobject\dbconnection.py",
line 850, in getConnection
"No connection has been defined for this thread "
AttributeError: No connection has been defined for this thread or process
|