[Zope-dev] Calling parent class method when method is overridden in current class?

Phil Harris phil.harris@zope.co.uk
Thu, 3 Aug 2000 09:13:52 +0100


Hi all,

I'm in the process of creating a Python based product, and have a need to
call the base classes index_html method.

My problem is that I need to call it from my classes index_html.

My class has DTMLDocument as the base class so I want to call something like
DTMLDocument.index_html().

This is my classes index_html (which by the way does not do as I want,
obviously or I wouldn't be posting this 8¬)):

def index_html(self,REQUEST,RESPONSE):
      """ this is a doc string """
      xml=self.inheritedAttribute(xmlRenderer,'index_html') # this is where
I want to call DTMLDocument's index_html()
      xsl=getattr(self,'style.xsl',None)
      if xsl is None:

xsl=open(INSTANCE_HOME+'/lib/python/Products/xmlRenderer/style.xsl','r').rea
d()
      else:
      xsl=xsl.document_src(REQUEST,RESPONSE)
      RESPONSE.setHeader('content-type','text/html; charset=UTF-8')
      return Sablot.ProcessStrings(xsl,xml)

The reason for wanting to do this is so I can get any DTML rendered before I
do my stuff with the results.  Which by the way means that I'll stick it
through a XSL processor with an associated stylesheet and get HTML back.

Any ideas?

tia

Phil
phil.harris@zope.co.uk