[SQLObject] FK bug? (object has no attribute 'id')
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: Luke O. <lu...@me...> - 2003-06-04 05:01:21
|
Ran into a bug with (at least) ForeignKeys. Actually, the bug is when we access
an attribute of an FK object that is a null entry. (Clearly, we shouldn't be
doing this, but the bug is that it's not raising NotFound, but getting through
to the attribute).
...
groupName = category.artworkGroup.name
File "<string>", line 1, in <lambda>
File "/usr/lib/python2.2/site-packages/SQLObject/SQLObject.py", line 692, in
_SO_getValue
results = self._connection._SO_selectOne(self,
[self._SO_columnDict[name].dbName])
File "/usr/lib/python2.2/site-packages/SQLObject/DBConnection.py", line 254,
in _SO_selectOne
return self.queryOne("SELECT %s FROM %s WHERE %s = %s" %
AttributeError: 'ArtworkCategory' object has no attribute 'id'
this is when category.artworkGroupID is NULL.
I'll look into this further tomorrow. In my glancing today I couldn't determine
why instantiating the artworkGroup object doesn't blow up, which is the
expected behavior, but instead an object WITHOUT an id field is being created.
Edmund's report may be related to this however, which is why i bring it up...
For now, just starting a thread to talk to myself in...
- Luke
|