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

Ian Bicking <[email protected]>
Newsgroups gmane.comp.web.zope.page-templates
Message-ID <[email protected]>
Ken Winter wrote:
>>Instead of obj.mypage.html, use obj['mypage.html']
>>
> 
> I'm afraid this doesn't work.  Here's the Python script, with the suggested
> syntax in the last line:
> 
> d = [{'person_id':p.person_id,\
>       'first_name':p.first_name,\
>       'middle_names':p.middle_names,\
>       'last_name':p.last_name}\
>      for p in context.read_all_people()]
> return context['studentlist.htm'](data=d)
> 
> This gets the error message:
> 
> Site Error
> An error was encountered while publishing this resource.
> Error Type: KeyError
> Error Value: 'studentlist.htm'
> 
> The same thing happens if I rename the ZPT as 'studentlist_htm" and use this
> syntax.  The only version that works is this:
> 
> return context.studentlist_htm(data=d)

This is the realm of things I don't understand well, but I think 
obj.value uses a somewhat different lookup algorithm (using Acquisition) 
than obj['value'].  Try getattr(context, 'studentlist.htm').

-- 
Ian Bicking  /  [email protected]  /  http://blog.ianbicking.org
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.