On Fri, Apr 9, 2010 at 10:49 AM, Oleg Broytman <phd@phd.pp.ru> wrote:
On Fri, Apr 09, 2010 at 10:37:06AM -0300, Juan Manuel Santos wrote:
> This error was raised on the first object creation the program does. However,
> If I make the code in main.py workaround this, it fails on the first select
> the program does.
> And no, I don't use fromDatabase = True, but would that help?

  Yes, it helps to understand what is going on. The test suite is used a
global connection so it cannot catch the bug in the code if there was no
  I will look into it and fix the bug.

    Oleg Broytman            http://phd.pp.ru/            phd@phd.pp.ru
          Programmers don't die, they just GOSUB without RETURN.

Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
sqlobject-discuss mailing list

I've been doing some testing. On a Jaunty installation, with most recent SQLObject (SVN), it doesn't make a difference if I set fromDatabase as a parameter when creating a class or doing a select. If I specify it inside the SQLObject class definitions (inside class sqlmeta), I get the same "No connection has been defined" but at starting time, when the first import of the class is being done.
With the SQLObject version that comes with Jaunty (0.10.2-3), fromDatabase is not recognized as a parameter to be passed at object creation (and I would assume for select isn't either, though I haven't tested). However, if I run the same test with this older version, it doesn't break at class creation but on the first select, and this is the traceback:

Traceback (most recent call last):
  File "/home/godlike/indexor/indexor/controller/mainhandler.py", line 514, in check_if_indexing_finished
  File "/home/godlike/indexor/indexor/controller/tvhandler.py", line 153, in print_output
    root = rootselect[0]
  File "/usr/lib/python2.6/dist-packages/sqlobject/sresults.py", line 173, in __getitem__
    return list(self.clone(start=start, end=start+1))[0]
  File "/usr/lib/python2.6/dist-packages/sqlobject/sresults.py", line 179, in __iter__
    return iter(list(self.lazyIter()))
  File "/usr/lib/python2.6/dist-packages/sqlobject/inheritance/iteration.py", line 26, in next
    if not self.lazyColumns: self.fetchChildren()
  File "/usr/lib/python2.6/dist-packages/sqlobject/inheritance/iteration.py", line 72, in fetchChildren
  File "/usr/lib/python2.6/dist-packages/sqlobject/inheritance/__init__.py", line 447, in select
    clause, *args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/sqlobject/main.py", line 1345, in select
    join=join, forUpdate=forUpdate)
  File "/usr/lib/python2.6/dist-packages/sqlobject/inheritance/__init__.py", line 34, in __init__
    dbName = (ops.get('connection',None) or sourceClass._connection).dbName
  File "/usr/lib/python2.6/dist-packages/sqlobject/dbconnection.py", line 819, in __get__
    return self.getConnection()
  File "/usr/lib/python2.6/dist-packages/sqlobject/dbconnection.py", line 832, in getConnection
    "No connection has been defined for this thread "
AttributeError: No connection has been defined for this thread or process

Hope it helps. Please do tell me if you need additional testing or info

Juan Manuel Santos