Tres Seaver wrote:

Adapters and subscription adapters should not be acquisition wrapped.
They darn well better be able to get a wrapped context (which means that
the event *must* have a wrapped attribute) or they will be less than
useless.
That's something else. Adapters and subscription adapters will get whatever they are looked up with. If that's wrapped, fine. E.g. if you do IWhatever(obj) and you got obj thru acquisition, then the IWhatever adapter will see obj with all its acquisition glory. But The adapter objects themselves shouldn't be wrapped. It would break, say, views which happen to be adapters.

I'll note that five views are already required to be acquisition wrapped
if they use any objects protected by Zope2 security machinery.

Yes, and this causes quite a lot of pain, mainly because self.context automatically becomes aq-wrapped, when it also has an inner aq chain (its containment chain, normally), and it's counter-intuitive that it should have an outer chain that includes the view. The wrapping is necessary to play nice in Zope 2, but I wish it wasn't.

I don't see any good reasons why *all* adapters should be aq wrapped. I've never needed an adapter (other than a view) that was able to acquire things from "self", and again this would screw with the self.context aq chain. Doing this by default would be really bad idea, imho, and encourage a style of programming that would be hard to untangle later.

Note that if you need an aq chain in an adapter, you're probably adapting an aq-wrapped context, and you can access self.context.aq_chain.

Martin

_______________________________________________
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests

Reply via email to