I'm thinking this has been mentioned on the list before, but getting an odd
error:
File "/usr/lib/python2.2/site-packages/SQLObject/SQLBuilder.py", line 126, in
sqlRepr
raise ValueError, "Unknown SQL builtin type: %s for %s" % \
ValueError: Unknown SQL builtin type: <class
'SQLObject.SQLObject.MetaSQLObject'> for <class
'MyContext.sqlobject.Motivation.Motivation'>
When I have two foreignKey's in a table to the same related table
Classes look like:
class StoryMotivation(CoreObject):
monkey = ForeignKey('Motivation')
donkey = ForeignKey('Motivation')
story = StringCol()
class Motivation(CoreObject):
name = StringCol()
The error happens during the second call to addColumn, and only if I import
StoryMotivation before Motivation (otherwise the rogue code below never gets
called due to how needSet works).
addNeedSet snippet:
cls = findClass(setCls, registry=registry)
if callable(getattr(obj, attr, None)):
getattr(obj, attr)(cls)
else:
setattr(obj, attr, cls)
I'm trying to understand the reason for trying to create an instance of the
class in the positive if statement. My code works if I comment that out (ie,
if obj.attr already exists, then pass, otherwise set it) or just always set
it. But ?
- Luke
|