Calling a method with form data in POST mode from python script
Hi, I don't know how to do a significant short title for that problem ;-)) So the subject is the question... Any clue ? Thanks in advance. --Gilles
There is an example of exactly this in the urllib and urllib2 documentation that comes with Python. ----- Original Message ----- From: "Gilles Lenfant" <glenfant@bigfoot.com> To: <zope@zope.org> Sent: Tuesday, February 12, 2002 3:53 PM Subject: [Zope] Calling a method with form data in POST mode from python script
Hi,
I don't know how to do a significant short title for that problem ;-)) So the subject is the question...
Any clue ?
Thanks in advance.
--Gilles
_______________________________________________ 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 )
Phil, I know this but urllib (as most packages) are not available in Zope restricted python scripts for "security" reasons. I found a workaround : handlerObject = restrictedTraverse(urlOfHandler) return handlerObject(context, context.REQUEST, param1=value1, param2=value2) ----- Original Message ----- From: "Phil Harris" <phil@harris-family.info> To: "Gilles Lenfant" <glenfant@bigfoot.com>; <zope@zope.org> Sent: Tuesday, February 12, 2002 4:58 PM Subject: Re: [Zope] Calling a method with form data in POST mode from python script
There is an example of exactly this in the urllib and urllib2 documentation that comes with Python.
Gilles Lenfant writes:
I don't know how to do a significant short title for that problem ;-)) So the subject is the question... When you read
<http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html> you will learn (Web publishing section), that Zope normalizes the request. There is no (only an insignificant) difference between GET and POST methods. That said, you question seems a bit confused to me. Apparently, your form action is a Python Script. When you plan to work with the request, it is probably not a bad idea to make "REQUEST" an argument of this script (however, you can access it also with e.g. "container.REQUEST", when you do not pass it directly). Then, you speak about a method that should be called with the form data. Let's say the method has name "m" and is accessible via the calling context. Then you can use: context.m(REQUEST) When that does not solve your question, you need to be a bit more specific... Dieter
participants (3)
-
Dieter Maurer -
Gilles Lenfant -
Phil Harris