#109 select() results empty when using 'import SomeSQLObject'

closed-invalid
nobody
General (125)
5
2005-09-13
2005-08-21
Anonymous
No

This appears to have been addressed for selectBy() but
not for select().
I fixed it on my box by copying the following line from
selectBy() to select()
'conn = connection or cls._connection'

I'm running under mod_python. My mod_python handler
class is in handler.py. The handler function loads
another file named moduser.py.
Here are the relevant excerpts.

---------------------
handler.py
---------------------
...
__connection__ = connectionFromURI("...")
class User(SQLObject):
_fromDatabase = True
...
userA = User.select(User.q.lastName=='doe')
userB = User.selectBy(lastName='doe')
...
mod = apache.import_module('moduser')

---------------------
moduser.py
---------------------
from handler import *
...
user1 = User.select(User.q.lastName=='doe')
user2 = User.selectBy(lastName='doe')
...
---------------------

userA, userB, and user2 all contain correct data. But
user1 returns an empty result set.

I tried to reproduce this problem using two simple
python programs but failed. It may only be reproducible
under mod_python. 'apache.import_module' reloads the
module on each invocation but I don't think it's related.

sourceforge (at)> hiddenlore <(dot) com

Discussion

  • Logged In: NO

    please disregard..

    it looks like I was running into a caching issue

     
  • Oleg Broytman
    Oleg Broytman
    2005-09-13

    • status: open --> closed-invalid