[Zope] Render a DTML doc from a python script (not external method)
Dieter Maurer
dieter@handshake.de
Sat, 21 Jul 2001 20:07:11 +0200 (CEST)
Gilles Lenfant writes:
> I make a Python script that chooses the DTML document where to go depending
> on the content of a form.
> The target DTML doc is in the same folder as the form (DTML doc too)
>
> I'm getting tired of trying to render the object correctly:
>
> (a) Trying to play with RESPONSE.redirect(...) does not work from Python
> script (in fact does nothing whatever I put as argument)
I cannot believe you:
I do it often (and successfull) with Zope 2.3.3.
> (b) "return container['mydtmldoc']" gives an unrendered document
As it should...
> (c) "return container['mydtmldoc'] (_.None, _)" give an AttributeError
> (Error value "validate") when rendering 'mydtmldoc'
That should work, provided that you have bound the namespace.
But try:
return container['mydtmldoc'](container,container.REQUEST)
That is how ZPublisher would call it.
Dieter