[Zope] Form POST Question (and a QUERY_STRING Q.)

Daryl Tester dt@picknowl.com.au
Sat, 03 Jun 2000 15:00:20 +0930


Stuart 'Zen' Bishop wrote:

> And another item from 'Sticky Tape & String Crackpot Solutions R Us':
> 
>     Write an external method that calls Pythons urllib or httplib methods to
>     suck in the desired URL and return it. You may be able to use
>     this as a replacement to redirect.

A while ago, I wrote something like (well, actually, it was exactly like):

from urllib import urlencode

def addRequestURL(REQUEST, url, dict = {}):
    "Return an URL with REQUEST.form encoded as a query string."
    newREQ = {}
    # Copy REQUEST.form
    for key, val in REQUEST.form.items():
        newREQ[key] = val
    # Overwrite with supplied values.
    for key, val in dict.items():
        newREQ[key] = val
    return url + '?' + urlencode(newREQ)

which allows you to add new/modify existing items in the query string.
Would that help, Mr Person Who Originally Started This Thread?

"Antipodean Hacks R Us"


Regards,
  Daryl Tester