>
> i think you understand this already; the way hasparent works is:
>
>       if a class "A" has a property "bs", managed by  
> InstrumentedAttribute "Bs" that points to instances of class "B", then
>       "B" is an orphan if its _state does not contain a record  
> "('hasparent',id(Bs))".
>

Right, that's what I thought should happen. Now continue your example  
so C has a property "b" managed by an InstrumentedAttribte "CB" that  
points to an instance of class B. In my case the instance of class  
"B" is getting a "('hasparent',id(CB))" record in its _state.

Ahh, it looks like the same thing is happening in your test program,  
so that's not causing my problem (and I guess it's not a bug either).  
Why does that happen though? Here's another example:

For reference, here's a snippet of the output of your test program:

Blog.posts 6092976
Post.blog 6071408
...
Blog: {('hasparent', 6071408): True, 'modified': True}
Post {('hasparent', 6206960): True, ('hasparent', 6092976): True,  
'modified': True}

Why does b._state have a 'hasparent' record for p1.blog? That would  
imply that "p1.blog" is the parent of "b", which doesn't seem logical  
to me. This is exactly what was happening in my program (and I  
thought it was a bug).

However, this does give me a better understanding of the  
InstrumentedAttribute parent tracking mechanism though, so thanks for  
that. It allowed me to reproduce the scenario that is happening  
within my program, and now I have a test that fails (see attached).

~ Daniel



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to