Re: RE: DreamWeaver files -> ZPTs: How?

Chris Beaven <[email protected]>
Newsgroups gmane.comp.web.zope.page-templates
Message-ID <[email protected]>
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).
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.