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

Phillip Hutchings sitharus at gmail.com
Mon May 23 17:14:21 EDT 2005


> 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
http://www.sitharus.com/
sitharus at gmail.com / sitharus at sitharus.com


More information about the ZPT mailing list