Render a DTML doc from a python script (not external method)
Hi, 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) (b) "return container['mydtmldoc']" gives an unrendered document (c) "return container['mydtmldoc'] (_.None, _)" give an AttributeError (Error value "validate") when rendering 'mydtmldoc' Note that of course calling mydtmldoc through a web browser works perfectly. Any hint ? TIA --Gilles
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
Thanks Dieter, it works for me with : return container['mydtmldoc'](context, context.REQUEST) ----- Original Message ----- From: "Dieter Maurer" <dieter@handshake.de> To: "Gilles Lenfant" <glenfant@bigfoot.com> Cc: <zope@zope.org> Sent: Saturday, July 21, 2001 8:07 PM Subject: Re: [Zope] Render a DTML doc from a python script (not external method)
participants (2)
-
Dieter Maurer -
Gilles Lenfant