On 07.09.2009, at 00:29, Oleg Broytmann wrote: > Now, much later after _init(), the instance of class C got the > attribute 'name'.
I know. The problem is that dir() lists it before that, which, as I wrote, breaks any code using introspection. SQLObject passes internally inconsistent objects to _init. In my case, a library implementing the observer pattern looks for a certain kind of method using a module that comes with Python: inspect.getmembers(self, predicate=lambda m: inspect.ismethod(m)) Internally that iterates over dir() and does isinstance(getattr). Code like this should never fail. The ugly part is that the reason dir() mentions 'name' is because it's in the __dict of the parent class, as a StringCol instance. Normally getattr does search there and would just return that StringCol. I guess the error stems from SQLObject overriding __getattribute__ or something with an implementation that is aware of columns, but at the time of _init is not defined. I think it should at all times behave like a normal Python object and just return StringCol if it doesn't have a value from the table yet. Or also override __dir__ and only list magic members when they actually work. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss