[mod_python] Re: how to access url parameters?

Chad Whitacre chad at zetaweb.com
Mon Dec 13 16:24:11 EST 2004


> parse_qsl appears to give a list, while parse_qs gives a dictionary. 
> The dictionary appears to return the values as lists.  So a key
> "param" will have a list "['value']".  I guess this must be to allow
> for multiple values per key (i.e.: form controls that allow for this).
>  For me it seems simpler to use parse_qsl (the list version) and turn
> it into a dictionary, so that I have single-value values.  Make sense?

Yes, good to know.


> Anyway, now I'm on to form values, and experimenting with why some
> form fields don't come through. :(  I'm on the trail, though. :)

Cool, good luck!


> Kevin
> 
> 
> On Mon, 13 Dec 2004 14:27:03 -0500, Chad Whitacre <chad at zetaweb.com> wrote:
> 
>>Kevin,
>>
>>Cool. I hadn't found parse_qsl yet but I imagine it just gives you the
>>qs in a dict?
>>
>>I've never actually used PSP so I'm not sure what it provides in terms
>>of debugging. mod_python itself is somewhat lower level than PHP so you
>>have to be more explicit, e.g., req.write(sys.exec_info()). Your errors
>>also show up in the Apache error log, of course.
>>
>>RE: my web apps ... they're all in Zope/Plone atm, so debugging means
>>digging through about 18 layers of cruft. ;-)
>>
>>
>>chad
>>
>>
>>
>>
>>Kevin White wrote:
>>
>>>chad,
>>>
>>>I'll take a look at what you recommended.  In the meantime, I had
>>>found an example using util.parse_qsl(req.args or '') and I've been
>>>trying that with some success.
>>>
>>>My frustration now is that I cannot seem to debug the program. :(  PHP
>>>gives quite good information when problems occur, but mod_python does
>>>not seem to be quite as friendly.  How do you debug your web apps?
>>>
>>>Thanks again,
>>>
>>>Kevin
>>>
>>>
>>>On Mon, 13 Dec 2004 11:43:37 -0500, Chad Whitacre <chad at zetaweb.com> wrote:
>>>
>>>
>>>>>I'm new to mod_python (and python itself, to be honest).  But I've
>>>>>programmed in many other languages (java, c#, VB.Net, PHP, ASP, etc.).
>>>>
>>>>Welcome :-)
>>>>
>>>>
>>>>
>>>>
>>>>>What I'm trying to figure out is how to access GET (querystring) and
>>>>>POST (form) parameters from a PSP page.
>>>>
>>>>The object representing your HTTP request is documented here:
>>>>
>>>>  http://modpython.org/live/current/doc-html/pyapi-mprequest.html
>>>>
>>>>Check out add_common_vars under "Methods" and subprocess_env and args
>>>>under "Members". Not sure about any PSP-specific steps needed though.
>>>>
>>>>hth,
>>>>chad
>>>>
>>>>_______________________________________________
>>>>Mod_python mailing list
>>>>Mod_python at modpython.org
>>>>http://mailman.modpython.org/mailman/listinfo/mod_python
>>>>
>>>
>>>
>>>
> 
> 



More information about the Mod_python mailing list