[Zope] index.html in Python Script?

Phillip Hutchings sitharus at gmail.com
Thu Apr 21 20:28:00 EDT 2005


On 22/04/05, Erik Myllymaki <erik.myllymaki at aviawest.com> wrote:
> How do address a ZPT with a name like index.html in a Python Script?
> 
> The following:
> 
> request = container.REQUEST
> RESPONSE =  request.RESPONSE
> 
> if not request.has_key('next_state'):
>    return container.index.html(context, request)

The . is the python object referencing notation, so you can't have a
property called 'index.html' addressable in the normal way. Use
getattr instead.

return getattr(container, 'index.html')(context, request)

It's all in the Zope documentation.
-- 
Phillip Hutchings
http://www.sitharus.com/
sitharus at gmail.com / sitharus at sitharus.com


More information about the Zope mailing list