aq_inContextOf/can anyone explain this zmonitor log?
Hi, I just experienced some very weird behaviour from aq_inContextOf while I was trying to get Cut and Paste to work (I had to trace to the whole security stuff to do this, and read the C source for the acquisition stuff the figure out what aq_inContextOf does of course... thanks for having such a great, consistent, mature and well-documented design Zope-guys...) oh, btw, Copy & Paste seems to work only for objects that have their User Source at the / level because of the behaviour of inContextOf. well, here's the log: Python 1.5.2 (#5, Aug 10 2000, 15:45:20) [GCC 2.95.2 19991024 (release)] Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam Welcome to <secure_monitor_channel connected 127.0.0.1:2625 at 859f680>
import Zope import Zope app=Zope.app() app=Zope.app() iee=app.iee iee=app.iee doc1=app.iee.doc1 doc1=app.iee.doc1 doc1.aq_inContextOf(iee) doc1.aq_inContextOf(iee) 0 doc1.aq_inContextOf(app) doc1.aq_inContextOf(app) 1 doc1.aq_inContextOf(app.iee) doc1.aq_inContextOf(app.iee) 0 iee.doc1.aq_inContextOf(app.iee) iee.doc1.aq_inContextOf(app.iee) 0 iee.doc1.aq_inContextOf(iee) iee.doc1.aq_inContextOf(iee) 1 app.iee.doc1.aq_inContextOf(iee) app.iee.doc1.aq_inContextOf(iee) 0 app.iee.doc1.aq_inContextOf(app.iee) app.iee.doc1.aq_inContextOf(app.iee) 0 doc1.aq_inContextOf(iee) doc1.aq_inContextOf(iee) 0 doc1=iee.doc1 doc1=iee.doc1 doc1.aq_inContextOf(iee) doc1.aq_inContextOf(iee) 1 doc1.aq_inContextOf(app.iee) doc1.aq_inContextOf(app.iee) 0 doc1=app.iee.doc1 doc1=app.iee.doc1 doc1.aq_inContextOf(app.iee) doc1.aq_inContextOf(app.iee)
On Mon, 21 Aug 2000 16:03:38 +0200, Bob Pepin <bpe@iee.lu> wrote: Yeah, this is a good one. Theres some debate in the Collector about whether this is actually a bug or not. In short, aq_inContextOf checks for nested aquisition contexts. It does *not* check for nested objects. It will return zero if you pass it parallel acquisition contexts, even if the objects are indeed nested.
iee=app.iee iee=app.iee
iee.doc1.aq_inContextOf(iee) iee.doc1.aq_inContextOf(iee) 1
This was what you expected
iee.doc1.aq_inContextOf(app.iee) iee.doc1.aq_inContextOf(app.iee) 0
Here the acquisition wrappers `iee` and `app.iee` are distinct objects. Here is the full story, and a patch to get it to work the other way. http://classic.zope.org:8080/Collector/1066/view (This patch used to work, but ive not used it since it was submitted) Toby Dickenson tdickenson@geminidataloggers.com
On Mon, Aug 21, 2000 at 04:21:33PM +0100, Toby Dickenson wrote:
On Mon, 21 Aug 2000 16:03:38 +0200, Bob Pepin <bpe@iee.lu> wrote:
Yeah, this is a good one. Theres some debate in the Collector about whether this is actually a bug or not.
In short, aq_inContextOf checks for nested aquisition contexts. It does *not* check for nested objects. It will return zero if you pass it parallel acquisition contexts, even if the objects are indeed nested. Here is the full story, and a patch to get it to work the other way.
http://classic.zope.org:8080/Collector/1066/view
(This patch used to work, but ive not used it since it was submitted)
hmm... shouldn't either User.BasicUser.allowed() or aq_inContextOf be modified then, since the intent in allowed() doesn't seem to be to check for nested contexts?
participants (2)
-
Bob Pepin -
Toby Dickenson