[Zope] modifying a url's query string

Roach, Mark R. mrroach@cimplify.net
26 Mar 2003 12:14:10 -0500


Hi, I'm wondering if there is a good way to modify the query string of a
get request to change a single variable. For example, let's say my dtml
method is accessed like this:

http://myzope/MyFolder/method?var1=foo&var2=bar

now I want one of the links on the page to load the same page, only with
a different value for var2.

I could use something like 
<dtml-var absolute_url>?var1=&dtml-var1;&var2=newvalue

but that seems cumbersome the longer the list of variables gets.

My first thought is to find some way to get the query string and make a
function that will convert it to and from a dictionary, allowing me to
change specific keys for new urls like

full_url_with_query({'var1':'newvalue'})

 but it seems that the only source of variable info is the (quite large)
REQUEST object. Is there any way to pull only the query string variables
out of the request, or even better, a function that does what my
imaginary "full_url_with_query" function wants to do?

Thanks for any suggestions,

Mark Roach