From: "Ross Boylan" <RossBoylan@stanfordalumni.org>
Just to be sure I understand: so if c is persistent, and I say c.d = a.__of__(b)
and then a few transactions later I come back and get c.d, I am not going to find it's a.__of__(b)?
I'm not 100% sure, I have only used __of__ in non.persistent ways, but I don't think it would work. It's not ment to work anyway. :-)
And also, does this mean that c.d = b.a also will not work?
It will work alright, but you won't find b in the acquisition when you access d.
The intended meaning is this: suppose Zope has invoked the method foo on the object a. Then a.b in foo (or, better, the expression self.b) does acquisition, but if I run off and pull an object c from the database, c.d will not have acquisition. Is that what you meant to say?
It's too late here, I have to think about that tomorrow. :-)
Clearly subclassing from Acquisition and Persistent is a necessary condition for storing acquisition contexts. Is it also sufficient? The statement 1 above seems to imply not, and the earlier statement (by someone else) that acquisition does not survive transaction boundaries goes further. As I understood it, it meant that it is impossible to store acquisition contexts reliably.
Well, you can't *store* them any differently than how you store them in the ZODB, thats correct. If you access /a/b/c that thats how your acquisition path will look, and you can't put in the object /d/e in that acquisition path permanently by storing it. If you need it there you either need to access c through /d/e/a/b/c, or you need to push e into the right place in the acqusition. We do the latter in our templating system, where we push a couple of objects inbetween the document and the documents parent to get the templates into actions.