> 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)
> ...which of course gets back to the original problem: DW doesn't handle
> extension-less files.
> Any suggestions?

The problem being that Python uses . as the object hierarchy
separator. Personally, I use a real text editor for Zope work.

This code works however, unless you have some oddball version of Zope.
It'll give nasty errors if studentlist.html doesn't exist, but there
you go.
getattr(context, "studentlist.html")(data=d)

Phillip Hutchings
ZPT mailing list

Reply via email to