[ZPT] RE: DreamWeaver files -> ZPTs: How?

Chris Beaven chris at d-designz.co.nz
Mon May 23 18:26:43 EDT 2005


Ken Winter wrote:

>The final line:
>
>return getattr(context, 'studentlist.htm')
>
>evokes a page containing nothing but:
>
><ZopePageTemplate at studentlist.htm>
>
>This is at least not an error message!  But I don't know how to get it to
>render the page instead of just showing this little identifier, or whatever
>it is.
>
>Also, I don't know how to pass parameters with this syntax.  The one that
>comes the closest to working is:
>
>return getattr(context, 'studentlist.htm'(data=d))
>
>which evokes:
>
>Site Error
>An error was encountered while publishing this resource.
>Error Type: TypeError
>Error Value: 'str' object is not callable
>
>Which at least implies that this syntax is recognized as an *attempt* to
>call studentlist.htm!
>
>Suggestions?
>
>- Ken
>
>  
>
You just need to call the value returned by getattr:

return getattr(context, 'studentlist.htm')(container, container.REQUEST)

It's in the Zope Book ;)

Your attempt at calling was trying to call the string 'studentlist.htm'. You can't call a string (it's unlisted in the phone book).



More information about the ZPT mailing list