Hello!
If I have a table that references another table, and during the
program execution I am trying to dereference the field, but the class
for the field is unknown (the apropriate module had not been imported
yet) I get AttributeError: instance has no attribute _SO_class_Name. For
example:
import SQLObject
from db import db_conn
class Barney(SQLObject.SQLObject):
_connection = db_conn
passion = SQLObject.ForeignKey("Wilma")
barney = Barney(1)
print barney.passion
AttributeError: Barney instance has no attribute _SO_class_Wilma. I
have spent entire day reading SQLObject sources trying to understand
what is going on. To make things much more funny, in the real program
Barney has __getattr__ method that caused infinite recursion, but that's
another story...
It would be helpful if SQLObject catch the AttributeError and reraise
it with a more meaningful message, something like "cannot make passion -
unknown class Willma".
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ ph...@ph...
Programmers don't die, they just GOSUB without RETURN.
|