[Zope] Printing DTML documents from PythonScripts

Mayers, Philip J p.mayers@ic.ac.uk
Tue, 13 Feb 2001 12:55:14 -0000


I've got a complex for processing application I'd like to implement in
PythonScripts rather than DTML. Ideally, like this:

PythonScript index_html:

print context.standard_html_header()
# do lots of complex processing
if not finished:
    print context.submission_form()
else:
    context.REQUEST.RESPONSE.redirect('done_html?id='+id)
    return ''
print context.standard_html_footer()
return printed

*But*, the standard_html_header/footer contain some complex stuff, including
a navigation bar and user-configurable stuff. Amongst other errors, I get
this:

Error Type: KeyError
Error Value: BASE1

Clearly, the DTML method has no namespace passed to it, so can't find
variables such as BASE1, and other Zope folders/methods. I *have* the
REQUEST and context objects in the python script - how do I pass them into
the DTML method?

Don't tell me to use a DTML method that calls out to a PythonScript please!
- I have numerous reasons for not wanting to do this :o)


Regards,
Phil

+----------------------------------+
| Phil Mayers, Network Support     |
| Centre for Computing Services    |
| Imperial College                 |
+----------------------------------+