[Zope-dev] Constructing a ZOPE request in a python script

Chris Withers chris at simplistix.co.uk
Mon Nov 7 14:42:47 EST 2005


Dave Coe wrote:
> I am hoping that someone can help me with how to
> construct a POST 
> request in a python script.  I tried searching the
> older messages, but post and get are such common
> terms, that I didn't have much luck.

This all feels amazingly clunky, but then you are using dtml, so that's 
to be expected. And you should probably be posting to zope at zope.org, 
since zope-dev is for development OF, not WITH Zope.

> I have a DTML Document with a form.  Right now, it
> calls a DTML method that stores data in the database. 
> What I am trying to do is insert a python script in
> between the two to do some data processing.  

So have the form submit to the python script and have the python script 
call the ZSQL method:

# whatever munging you want
x = y + 1 + context.REQUEST.get('something')
context.myZSQLMethod(someparam=x)
return 'thanks, done!'

cheers,

Chris

PS:
> incorrect). In any event, I would like to construct a
> POST request in the python script instead and then
> call RESPONSE.redirect().  Can this be done?

No, you can't redirect a POST using a 302 response, especially if you 
want to process along that way. That's http ;-)

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk



More information about the Zope-Dev mailing list