[mod_python] Query Strings

Sean Keesler smkeesle at syr.edu
Wed Nov 3 07:50:53 EST 2004

Looking through the docs I can't find much about how to handle variables 
passed thought the url in a query string.  I did see that 
request.subprocess_env['QUERY_STRING'] returns the query string, but 
isn't their a library written to create a dictionary or assign variables 
values from the query string?  I saw reference to publisher's ability to 
do this, but I can't find it in the docs...

Here's what I am doing...

def text(req):
    req.content_type = "text/html"
    parseduri = req.subprocess_env['QUERY_STRING']
    req.write(repr(parseduri) + '<br>')
    pairlist = string.split(parseduri, '&')
    for pair in pairlist:
        k,v = string.split(pair, '=')
        if k == 'myvariable':
              myvariable = v

More information about the Mod_python mailing list