[Zope] Why is index_html() called instead of __call__()?

Brian Lloyd brian@zope.com
Mon, 6 Jan 2003 11:18:19 -0500


> > It sounds like the 
> > PropertyFolder implementation might want to do something like:
> > 
> > class PropertyFolder(...):
> >   def __call__(...):
> >       ...
> > 
> >         # alias to be sure we always control our rendering
> > 	  index_html = __call__
> 
> This would result in never being able to call the index_html in the
> ZODB.
> 
> --kyler

Sure you could :) You just have to do it explicitly:

  def __call__(self, REQUEST, ...):
    if i_want_to_call_acquired_index_html:

      # acquire it from our parent, to avoid getting our own!
      index_html = getattr(self.aq_parent, 'index_html', None)
      if index_html is not None:
        return index_html(self, REQUEST)

    ...

        
  index_html = __call__




Brian Lloyd        brian@zope.com
V.P. Engineering   540.361.1716              
Zope Corporation   http://www.zope.com