[ZPT] Can't use 'document_src' in python script - a PageTemplate alternative?

Tony McDonald tony.mcdonald@ncl.ac.uk
Thu, 06 Sep 2001 14:20:07 +0100


Hi all,
This is a rehash of a XXX-PythonMethod (remember them!)

I had this at the top of my original XXX-PythonMethod

import DocumentTemplate
savedir = self.savedir
template_str = self.template.read_raw()
template = DocumentTemplate.HTML(template_str)

...and further on...
theresult = template(self, results=results, identifier=identifier)
return theresult

(ie it gets a DTML method called 'template' and then fills in the <dtml-var
results> and <dtml-var identifier> areas to create a filled-in document)

But the PythonScript complained a bit, so I changed it to

import DocumentTemplate
self = context
REQUEST = self.REQUEST
savedir = self.savedir
# template_str = self.template.read_raw()
template_str = self.template.document_src()
template = DocumentTemplate.HTML(template_str)

But it still doesn't want to let me touch document_src (it also complained
about read_raw).

I'm in the process of changing this site to use ZPT, so is there a better
way of doing this using PythonScripts and PageTemplates?
What is the idiom for doing this sort of thing in ZPT anyhow?

TIA
Tone.
-- 
Dr Tony McDonald,  Assistant Director, FMCC, http://www.fmcc.org.uk/
The Medical School, Newcastle University Tel: +44 191 243 6140
A Zope list for UK HE/FE  http://www.fmcc.org.uk/mailman/listinfo/zope