[ZPT] RE: DreamWeaver files -> ZPTs: How?
Ian Bicking
ianb at colorstudy.com
Mon May 23 17:12:48 EDT 2005
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 / ianb at colorstudy.com / http://blog.ianbicking.org
More information about the ZPT
mailing list