Hi guys, Does anyone know how to disable acqusition ? That is, with a simple method, and not disabling the Acqusition class, something like self.aq_disabled('attribute') . Thanks. -Morten
morten@esol.no wrote:
That is, with a simple method, and not disabling the Acqusition class, something like self.aq_disabled('attribute') .
So kindof the inverse of using Aquisition.Explicit and using the aq_acquire method? What you describe would be really cool... The only workaround for now is to use calls to ac_acquire() and provide a filter function, but this doesn't help when other code that you have no control over accesses an attribute that you'd rather not have acquired :-( cheers, Chris PS: http://www.zope.org/Members/michel/Projects/Interfaces/AcquisitionWrappedObj...
I'm almost beginning to understand Acquisition. I can see that it's possible to control the things that my class acquires ie import or ancestor acquisition control, but is it possible to control what other classes acquire from me sort of export/descendant control. -- Robin Becker
Chris Withers wrote:
morten@esol.no wrote:
That is, with a simple method, and not disabling the Acqusition class, something like self.aq_disabled('attribute') .
So kindof the inverse of using Aquisition.Explicit and using the aq_acquire method?
What you describe would be really cool...
The only workaround for now is to use calls to ac_acquire() and provide a filter function, but this doesn't help when other code that you have no control over accesses an attribute that you'd rather not have acquired :-(
I'm inclined to think that in some future version of Zope, we should switch to making explicit acquisition the norm. Jim -- Jim Fulton mailto:jim@digicool.com Python Powered! Technical Director (888) 344-4332 http://www.python.org Digital Creations http://www.digicool.com http://www.zope.org
Surely you jest ? I may be out of line, I am quite new to Zope and have only made a few python products, but the nice thing I felt Acquisition.Implicit gave was a sense of being able to put a method into an environment and let it "discover" what was around it. Aquisition.Explicit I thought was where you knew specific things about your environment and wanted them from there instead of what you had brought along yourself. Matt On Sat, 09 Dec 2000, Jim Fulton wrote:
Chris Withers wrote:
morten@esol.no wrote:
That is, with a simple method, and not disabling the Acqusition class, something like self.aq_disabled('attribute') .
So kindof the inverse of using Aquisition.Explicit and using the aq_acquire method?
What you describe would be really cool...
The only workaround for now is to use calls to ac_acquire() and provide a filter function, but this doesn't help when other code that you have no control over accesses an attribute that you'd rather not have acquired :-(
I'm inclined to think that in some future version of Zope, we should switch to making explicit acquisition the norm.
Jim
-- Jim Fulton mailto:jim@digicool.com Python Powered! Technical Director (888) 344-4332 http://www.python.org Digital Creations http://www.digicool.com http://www.zope.org
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope ) -- Matt Halstead (PhD) Research and development VirtualSpectator http://www.virtualspectator.com ph 64-9-9136896
On Fri, 08 Dec 2000 10:57:48 -0500, Jim Fulton <jim@digicool.com> wrote:
I'm inclined to think that in some future version of Zope, we should switch to making explicit acquisition the norm.
Jim, do you have any opinions on some of the other acquisition strategies that have been mentioned on the list? In particular, there seems to be merit in an acquisition that searches only the containment heirarchy. Toby Dickenson tdickenson@geminidataloggers.com
Toby Dickenson wrote:
On Fri, 08 Dec 2000 10:57:48 -0500, Jim Fulton <jim@digicool.com> wrote:
I'm inclined to think that in some future version of Zope, we should switch to making explicit acquisition the norm.
Jim, do you have any opinions on some of the other acquisition strategies that have been mentioned on the list?
I don't have time to read the list normally. :( (This is bad. I need to fix this and am trying to ....)
In particular, there seems to be merit in an acquisition that searches only the containment heirarchy.
Of course. Zope already doesn this for security. It does this by brute force most of the time, although there's now more API support for it. There's a 'containment' keyword flag argument to the aq_acquire method, so, at least from Python, you can force acquisition to search *only* the containment hierarchy. I think that there's merit to providing more control over how acquisition happens. This is consistent with making acquisition more explicit. Jim -- Jim Fulton mailto:jim@digicool.com Python Powered! Technical Director (888) 344-4332 http://www.python.org Digital Creations http://www.digicool.com http://www.zope.org
Toby Dickenson wrote:
In particular, there seems to be merit in an acquisition that searches only the containment heirarchy.
...I liked the context one that was discussed last year and which Evan provides some external methods to explement. cheers, Chris
Jim Fulton wrote:
I'm inclined to think that in some future version of Zope, we should switch to making explicit acquisition the norm.
Well, implicit is good when you're starting, but can cause fun with security later. Hmmm, I guess I like the way it is but my wishlist (damn, Christmas just gone ;-) would be: for Acquisiton.Implicit, be able to do something like: class MyClass (Acquisition.Implicit): acquisition = ClassAcquisitionInfo() acquisition.donotacquire('index_html') and, likewise, for Acquisition.Explicit, to be able to to something like: class MyClass (Acquisition.Explicit): acquisition = ClassAcquisitionInfo() acquisition.acquire('index_html') acquisition.acquire('fred') ...of course, you may be able to do this already in some way. What do people think? cheers, Chris
On Wed, 6 Dec 2000 morten@esol.no wrote:
Does anyone know how to disable acqusition ?
That is, with a simple method, and not disabling the Acqusition class, something like self.aq_disabled('attribute') .
I believe one way is self.aq_base['attribute']. aq_base gets the unwrapped object (what got __of__'ed). If you're not sure the thing is acquisition-wrapped in the first place, you'd probably want to check for the existing of the 'aq_base' attribute before using it... Ken Manheimer klm@digicool.com
Ken Manheimer wrote:
On Wed, 6 Dec 2000 morten@esol.no wrote:
Does anyone know how to disable acqusition ?
That is, with a simple method, and not disabling the Acqusition class, something like self.aq_disabled('attribute') .
I believe one way is self.aq_base['attribute']. aq_base gets the unwrapped object (what got __of__'ed).
What if the base object's not a dictionary?
If you're not sure the thing is acquisition-wrapped in the first place, you'd probably want to check for the existing of the 'aq_base' attribute before using it...
Am I imagining things of did Jim F say he might make ac_base present in all the acquisition classes so that kind of checking isn't necessary? cheers, Chris
On Wed, 6 Dec 2000, Chris Withers wrote:
Ken Manheimer wrote:
On Wed, 6 Dec 2000 morten@esol.no wrote:
Does anyone know how to disable acqusition ?
That is, with a simple method, and not disabling the Acqusition class, something like self.aq_disabled('attribute') .
I believe one way is self.aq_base['attribute']. aq_base gets the unwrapped object (what got __of__'ed).
What if the base object's not a dictionary?
I suspect i was missing something, but i assumed since he was referring to an attribute of the object, that morten did not mean to write a function call form. I probably should have presumed toward attribute lookup: self.aq_base.attribute or getattr(self.aq_base, 'attribute') - and been explicit that i was reading between the lines, in the first place.
If you're not sure the thing is acquisition-wrapped in the first place, you'd probably want to check for the existing of the 'aq_base' attribute before using it...
Am I imagining things of did Jim F say he might make ac_base present in all the acquisition classes so that kind of checking isn't necessary?
Dunno. Ken klm@digicool.com
On Wed, 6 Dec 2000 morten@esol.no wrote:
Does anyone know how to disable acqusition ?
That is, with a simple method, and not disabling the Acqusition class, something like self.aq_disabled('attribute') .
Might this be what you are looking for? http://www.egroups.com/message/zope/45049 Regards, Stefan
"Stefan H. Holek" wrote:
Might this be what you are looking for?
Spot on I think :-) Many thanks, Chris
participants (8)
-
Chris Withers -
Jim Fulton -
Ken Manheimer -
matt -
morten@esol.no -
Robin Becker -
Stefan H. Holek -
Toby Dickenson