In Plone adding a member variable in a view class instance automatically makes it a part of view acquisition chain. The problem is described in detail here:
What is the suggested approach for dealing with this problem
-
Can we have Plone main template based views without implicit acquisition
-
How about viewlets and portlet renderers then?
-
If not… how one should deal with the problem so that self.xxx variables do not get extra acquisition wrapping?
Use
Acquisition.aq_inner()to strip away the extra wrapping and restore the object to it’s original path. Please, do not use the single-item list approach as described in the document you link to.To show one example from the linked document, but corrected with
aq_inner():Alternatively, you can use the
aq_innerattribute:but that only works on objects that inherit from
Acquisition.ExplicitorAcquisition.Implicit; theaq_inner()function returns the passed argument verbatim if it is not a Acquisition-wrapped object.