MessageDialog in Python Script
Hi, is there a possibility to return a message while executing without to interupt the Script or redirect to another one (because of variable-transfer)? As message from Globals.MessageDialog is unauthorized in Python Scripts. -- many thanks for your replies, Elena
Inside a PythonScript, you can use: context.REQUEST.RESPONSE.write(string) as much times as you need it. You need to take into account that all what your page will render are the streamed strings, and that any 'return something' at the end of the script wil not work, unless it's another response like 'RESPONSE.redirect(url)'. Because of that, you may avoid using it for generating html code that relies on closing tags, like tables. Ausum ----- Original Message ----- From: "Elena Schulz" <elena.schulz@gmx.net> To: <zope@zope.org> Sent: Friday, November 29, 2002 9:56 AM Subject: [Zope] MessageDialog in Python Script
Hi,
is there a possibility to return a message while executing without to interupt the Script or redirect to another one (because of variable-transfer)? As message from Globals.MessageDialog is unauthorized in Python Scripts.
-- many thanks for your replies, Elena
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Ausum Studio writes:
Inside a PythonScript, you can use:
context.REQUEST.RESPONSE.write(string)
as much times as you need it.
You need to take into account that all what your page will render are the streamed strings, and that any 'return something' at the end of the script wil not work, unless it's another response like 'RESPONSE.redirect(url)'. This will not work either:
"Response.redirect" works by sending an appropriate HTTP response code. But this is already written in the first "write". There is no way to send a second one. Dieter
---- Original Message ----- From: "Dieter Maurer" <dieter@handshake.de> To: "Ausum Studio" <ausum_studio@hotmail.com> (...)
This will not work either:
"Response.redirect" works by sending an appropriate HTTP response code.
But this is already written in the first "write". There is no way to send a second one.
I'm afraid that's correct. A tested workaround to perform a redirection after a page is streamed via RESPONSE.write sentences is to use Javascript, that is, 'window.open' at the bottom of the page, with the destination url and '_self' as the only two parameters. Ausum
Dieter
participants (3)
-
Ausum Studio -
Dieter Maurer -
Elena Schulz