Aquisition and supermethod calls
Hi, I was wonder how one should do an analog of supermethod calls for aquisition. For example I may want the index_html in some folder to wrap some information around the aquired index_html. I have come up with the incantation +++++ index_html ++++ some added stuff <dtml-var "PARENTS[1].index_html(this(),REQUEST,RESPONSE)"> some more added stuff ++++++++++++++++++++++ This, however, leads to infinite recursion errors if the new index_html is itself being acquired. Is there a better way to do what I want? [Using header and footer methods will not help, since "index_html" is not the the method I am actually working with] thanks Daniel
From: "Daniel Mahler" <mahler@cyc.com>
Is there a better way to do what I want?
Probably. The question is: What do you want? :-) What is it that you are trying to accomplish, more specifically? For exmple, if it is not index_html, why must the methods be called the same?
Lennart Regebro writes:
From: "Daniel Mahler" <mahler@cyc.com>
Is there a better way to do what I want?
Probably. The question is: What do you want? :-)
What is it that you are trying to accomplish, more specifically? For exmple, if it is not index_html, why must the methods be called the same?
I am trying to extend a 3rd party product: they provide both the method and code in their product also calls the method. I want to customize the method's behaviour when their code calls it. I just used to override the method, but that is a maintenance nightmare. D
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
From: "Daniel Mahler" <mahler@cyc.com>
I am trying to extend a 3rd party product: they provide both the method and code in their product also calls the method. I want to customize the method's behaviour when their code calls it. I just used to override the method, but that is a maintenance nightmare.
I would subclass the method and make a new product.
Daniel Mahler writes:
I was wonder how one should do an analog of supermethod calls for aquisition. For example I may want the index_html in some folder to wrap some information around the aquired index_html. I have come up with the incantation
+++++ index_html ++++ some added stuff <dtml-var "PARENTS[1].index_html(this(),REQUEST,RESPONSE)"> some more added stuff ++++++++++++++++++++++ There are two problems:
1. Usually, it is not easy to get a hold on the executing DTML method. You may be lucky in special cases, i.e. when it is "REQUEST.PUBLISHED". 2. When you can access the object "o", you can use "o.aq_inner.aq_parent" (this is the equivalent of "container(o)" to go up one step towards to root (you must go up twice!). Unfortunately, "aq_inner" is not exposed to DTML/Python Scripts (don't know why, its just the case). Therefore, you must use this in an External Method or other file system based code. Dieter
participants (3)
-
Daniel Mahler -
Dieter Maurer -
Lennart Regebro