[mod_python] Mod_python + arguments

Glenn A. Hochberg gah at research.att.com
Sat Jan 24 15:47:35 EST 2004


That's not how you get access to query args.  You need to use the 
FieldStorage class; see the documentation at modpython.org.

    -Glenn

>Date: Fri, 23 Jan 2004 11:58:22 -0800
>From: Joshua Schmidlkofer <menion at asylumwear.com>
>Subject: [mod_python] Mod_python + arguments
>To: ModPython mailing List <mod_python at modpython.org>
>Message-ID: <1074887901.5984.93.camel at bubbles.imr-net.com>
>Content-Type: text/plain
>
>My mod_python script is not getting any arguments.  I have googled a
>bit, and looked my small archive of the mailing list.  I don't see the
>problem being references.
>
>Stock RedHat 9:
>   mod_python-3.0.1-3
>   httpd-2.0.40-21.9
>   python-2.2.2-26
>
>I can upgrade if needed, but I just wondered if that is necessary.
>
>Apache config:
><snip>
>
><Location /proxy>
>    SetHandler python-program
>    PythonPath "sys.path + ['/var/www/html/proxy']"
>    PythonHandler handler
>    #PythonHandler mod_python.publisher
></Location>
>
><snip>
>
>
>
>Here is my url:
>http://localhost/proxy/handler?crow=bar&name=foo
>
>here are a few things:
>uri: (None, None, None, None, None, None, '/proxy/handler', 'crow=bar&name=foo', None)
>
>I can't get named arguments, and *args, and **kwargs reveals nothing:
>
><snip>
>  kwargs:{}
>    args:()
><snip>
>
>
>my script:
>
><snip>
>from mod_python import apache
>
>def handler(req, *args, **kwargs):
>    req.content_type = "text/html"
>    req.send_http_header()
>
>    extra = ""
>    for k,v in locals().items():
>        if k == 'extra': continue
>        extra += "<p>%s:%s\n" % (str(k),str(v))
>        continue
>
>    extra += "<br><hr>\n"
>    extra += "Args:<p>len: %d<br><p>contents: %s\n" % (len(args),str(args))
>    
>    extra += "<br><hr>\n"
>    extra += "uri: %s<br><br>\n" % str(req.parsed_uri)
>    extra += "args: %s<br><br>\n" % str(req.args)
>    extra += "req: %s\n" % str(dir(req))
>   
>    extra += "<br><hr>\n"
>    extra += "<br>Apache: %s\n" % str(dir(apache))
>
>    req.write(content % extra)
>
>    return apache.OK
><snip>
>
>
>  
>



More information about the Mod_python mailing list