[Zope] Why is index_html() called instead of __call__()?
Kyler Laird
kyler-keyword-zope.c87f05@lairds.org
Sat, 4 Jan 2003 13:55:15 -0500
Brian wrote:
> ZPublisher looks first for index_html, and will only use __call__
> if it doesn't find an index_html on the published object.
Looking at ZPublisher/BaseRequest.py, I'm starting to understand.
> Note
> that the index_html may be acquired from a containing object, so
> an object that always wants to control its own rendering should
> define its own index_html to prevent that.
Further, this is the *only* way to do it. As I've noticed recently,
any attempts to delete index_html in the root folder will result in
recreation at the next upgrade (for Debian at least). Because there
will always be an index_html in the heirarchy, there is no way to
affect behavior by defining __call__.
Because there is no hook before index_html, is is impossible to
(cleanly) make an object that renders itself sometimes, and allows
index_html to do it at other times.
> 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