[I sent this yesterday but it seems like it never went through.  If for some reason you get two copies, I apologize.]

So I'm happily developing a CherryPy-SqlObject-Cheetah application when i decide that I should really be using some more SqlObject features.  Namely ForeignKeys and SingleJoins. 

After destroying my application, I wrote a simple test case.....hopefully someone can take a look at it and tell me what I'm doing wrong.

#!/usr/bin/python

from sqlobject import *

class Wstore(SQLObject):
    companyId = StringCol(default=None, alternateID=True, length=60)
    companyName = StringCol(default=None)
    specialSearchR = SingleJoin('SpecialSearch')

class SpecialSearch(SQLObject):
    companyId = ForeignKey('Wstore', alternateID=True)
    secondStageMatch = StringCol(default=None)
 
connection = connectionForURI("mysql://root:password@localhost/testdb")
sqlhub.processConnection = connection

Wstore._connection.debug = True
SpecialSearch._connection.debug = True
Wstore.createTable()
SpecialSearch.createTable()

x=Wstore(companyId="TheCompany
", companyName="The Company")
y=SpecialSearch(companyId=x.id, secondStageMatch="foo")

z=x.SpecialSearchR

---------

So my first question is the line
 y=SpecialSearch(companyId=x.id, secondStageMatch="foo")

That line seems to work, but I would have expected ForeignKeys to work more like
y=SpecialSearch(companyId=x, secondStageMatch="foo")

After all it's a foreign key to the object right?

My second questions is the line
z=x.SpecialSearchR
...this doesn't work at all.  I would have expected it to to return what I just stored in y.

Any idea why it doesn't work?

Thanks!