[Zope] accessing overridden methods

Brian Withun brianw@hilgraeve.com
Thu, 18 Oct 2001 16:31:53 -0400


I'm having a little difficulty with Zope inheritance.

What I'd like to do is have a child folder (derived class)
override a method foo() of it's parent (base class).

In the child class, I want foo() to do it's thing and then
call the overridden foo() method of it's parent.

I have tried a child.foo() like this:

<p> child foo </p>
<dtml-with "PARENTS[1]">
  <dtml-var foo>
</dtml-with>

but that introduced undesirable behavior by placing the
PARENTS[1] namespace above the current (PARENTS[0]) namespace,
so I tried:

<p> child foo </p>
<dtml-var "PARENTS[1].foo(_.None,_)">

but that didn't really work, either.  The reason this fails is
because "PARENTS[1]" is always relative to the object that was
accessed in the current request.  This leads to infinite recursion
when I create a further-nested subfolder (BaseClass.Child.GrandChild.foo)

Is there another way?

------------
Brian Withun
Web Developer
Hilgraeve, Inc.
Monroe, Michigan 48161