[Zope] python class instances named index_html

Mark James Adams mark@raysend.com
Thu, 2 Aug 2001 14:24:34 -0400


Hi, gang:

I have a python class with an index_html default method. If I access 
http://localhost/myobject it returns the output from the index_html 
method correctly. However, if myobject is named index_html 
(http://localhost/index_html), I get the following error:

Site Error
An error was encountered while publishing this resource.
Resource not found
Sorry, the requested resource does not exist.
Check the URL and try again.
<!--
MyPythonClass instance at 14fa320
-->

Traceback (innermost last):
   File /usr/local/Zope/lib/python/ZPublisher/Publish.py, line 223, in 
publish_module
   File /usr/local/Zope/lib/python/ZPublisher/Publish.py, line 187, in 
publish
   File /usr/local/Zope/lib/python/Zope/__init__.py, line 226, in 
zpublisher_exception_hook
     (Object: LockableItem)
   File /usr/local/Zope/lib/python/ZPublisher/Publish.py, line 173, in 
publish
   File /usr/local/Zope/lib/python/ZPublisher/HTTPResponse.py, line 308, 
in setBody
   File /usr/local/Zope/lib/python/ZPublisher/HTTPResponse.py, line 547, 
in notFoundError
NotFound: (see above)

However, if I call my method as http://localhost/index_html/index_html, 
I get the correct output.

 From the "MyPythonClass instance at 14fa320" in the error log, I imagine 
that Zope is returning my actual class instance, rather than calling 
index_html. Perhaps it autmatically calls "index_html" and the first 
thing it finds in the namespace is my object named index_html.

My only guess is that I need to override __call__, but I'm not sure 
what's involved in doing that.

Thanks!