Combining GET and POST request

11 views
Skip to first unread message

Karsten Fuhrmann

unread,
Jan 20, 2012, 10:31:22 AM1/20/12
to trac...@googlegroups.com
Hello,
i am using a POST request for one of my forms but still want to be able to access the get parameters.
The usual
param1 = req.args.get('param1', '')

is not working in the POST request. But the get param is in the URL, when i look at the output of tracd.

127.0.0.1 - - [20/Jan/2012 16:07:19] "POST /svnpermcontrol?param1=admin&param2=on HTTP/1.1" 200 -

Any ideas how to access the get parameters in a post request?

Greetings,
Karsten Fuhrmann
System Administrator
Cartoon-Film Thilo Rothkirch




Christian Boos

unread,
Jan 20, 2012, 2:29:31 PM1/20/12
to trac...@googlegroups.com
On 1/20/2012 4:31 PM, Karsten Fuhrmann wrote:
> Hello,
> i am using a POST request for one of my forms but still want to be able
> to access the get parameters.
> The usual
> param1 = req.args.get('param1', '')

This should work.

>
> is not working in the POST request. But the get param is in the URL,
> when i look at the output of tracd.
>
> 127.0.0.1 - - [20/Jan/2012 16:07:19] "POST
> /svnpermcontrol?param1=admin&param2=on HTTP/1.1" 200 -
>
> Any ideas how to access the get parameters in a post request?
>

For a POST, you shouldn't pass parameters in the URL, but rather
use <input> elements (type=hidden if you don't want to see them).

While Python >= 2.6 normally would combine the URL parameters
with those in the application/x-www-form-urlencoded content of
the POST, Trac sticks with the pre-0.6 behavior of only taking
into account the POST parameters from the content, ignoring those
found in the URL (see http://trac.edgewall.org/changeset/7774).

-- Christian

Reply all
Reply to author
Forward
0 new messages