Acquisition in Python Product
Hi, 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 : .../Instance_of_FolderClass/Folder/Instance_of_DataClass 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. ;-) greetings Achim
Hi again, I was able to bring my problem a little bit more 'to the point':
From a python class I call a DTML-Method through Acquisition (two levels up in the hierarchy). In this DTML-Method I call a method of the containing object :
in the DTML-Method: <dtml-var absolute_url> <dtml-var expr='myTestFkt(REQUEST)'> here absolute_url gives the url of the original object I access via the url, but in the function: def myTestFkt(self,REQUEST): # try to access the 'original' object print self.absolute_url() gives me the url of the object containing the DTML-Method. Why ? How can I get the original object which the request has asked for ? greetings Achim
participants (1)
-
Achim Domma