Axiom Testing

Gabriel Jacobo <[email protected]> Fri, 10 Feb 2006 14:32:50 -0300
Newsgroups gmane.comp.python.quotient.dev
Message-ID <[email protected]>
Hi! I´m testing the axiom database. I just tried to do a simple test 
with two classes, but I´m running into a little problem...the exception 
" 'TestA' object did not have attribute '_storeID'" keeps rising up...

I´ve followed the path of execution, and arrived to a conclusion. At a 
certain point when instantiating my item.Item inherited class, the 
method __set__ for the class SetOnce gets executed.

The first line of this method says: "if not hasattr(iself, 
self.trueattr)", where self.truattr is "_storeID". If I understand 
correctly, Axiom is trying to check if the attribute _storeID is already 
set or not. The thing is, this leads (at least on my Python 2.4 for 
Windows), to the __get__ of the Allowed class, which tries to "if 
self.name in oself.__dict__:", but of course _storeID is not there yet, 
so it raises the exception.

I fixed this modifying the line "if not hassattr(iself, self.trueattr)" 
SetOnce.__set__ for "if not self.truattr in iself.__dict__" and from 
then on everything went fine...

Is this a bug or is there something else I´m missing? I´ve tried this on 
Axiom 0.4 and SVN version, with Python 2.4 under Windows.

By the way, I´m trying to add a "safe reference" behavior to Axiom 
(references that keep ref counts to avoid elimination of referenced 
objects), but the only way I´ve found to add behavior to item.Item is by 
changing the code right there, I mean I couldn´t find a way to "cheat" 
the "inheritance protection" system. Which is the recommend way of doing 
this?


Thanks.

Gabriel.