Hey,

I'm having troubles getting some simple SQLObject relationship code to
work (example is actually from page 167 in the TG book).  The
following is in model.py:

class PythonFunction(SQLObject):
    name=StringCol()
    module_id = ForeignKey('PythonModule')

class PythonModule(SQLObject):
    name=StringCol()
    functions=MultipleJoin('PythonFunction', joinColumn='module_id')

I can then use catwalk to first add a PythonModule named "xxx".  Then
I add two functions "foo()" and "bar()" to PythonFunction with no
problem.  However when I go to browse the PythonModule object again I
get an error:

  File "/usr/local/lib64/python2.4/site-packages/SQLObject-0.7.2b1-
py2.4.egg/sqlobject/sqlbuilder.py", line 374, in __getattr__
    raise AttributeError("%s instance has no attribute '%s'" %
(self.soClass.__name__, attr))
AttributeError: PythonFunction instance has no attribute 'moduleID'

The output from tg-admin sql sql is (using sqlite):

CREATE TABLE python_function (
    id INTEGER PRIMARY KEY,
    name TEXT,
    module_id INT CONSTRAINT module_id_exists REFERENCES
python_module(id)
);
;;

CREATE TABLE python_module (
    id INTEGER PRIMARY KEY,
    name TEXT
);
;;

I'm not sure if this is a problem with the code, or with
Catwalk..maybe it works for someone else?

Any ideas would be much appreciated, thanks
-Chris


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to