[Zope] Acquisition in Python Product

Achim Domma achim.domma@syynx.de
Mon, 8 Oct 2001 14:11:09 +0200


I'm delevoping a python product and have some problems understanding
acquisition in this context. I will try to describe the situation as short
as possible:

I have defined two classes with implicit acquisition. One is an object
manager which I will call FolderClass, the other is a simple data container
which I will call DataClass.

The hierarchy of the objects is :

Because I want to define the layout of DataClass in the FolderClass, I
define the following index_html for DataClass:

def index_html(self,REQUEST):
    """some docu"""
    p = getattr(self,'displayDCMethod',some_default)
    return p(self,REQUEST)

now I define a DTML-Method 'displayDCMethod' in FolderClass, which calls a
memberfunction of FolderClass:

<dtml-var expr='myTestFkt(REQUEST)'>

defined as:

def myTestFkt(self,REQUEST):
    # try to access the 'original' object

Sorry for the long explanation, but here's my problem: I think self in
myTestFkt should be an acquisition wrapper around my Instance_of_DataClass,
but using aq_base I only get Instance_of_FolderClass.

What's going wrong here ? Can somebody explain to me, why self is not
Instance_of_DataClass and how I can get it ?

If my construction is to complicated and could be made easier I would also
be glad to hear the solution. ;-)