[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

post variable

pavloutefkros@gmail.com

1/28/2008 6:38:00 PM

sorry for creating a new post but this is totally different from the
previous one.

Here is the problem (which is very hard to explain, so i will use a
paradigm): i submit a form and the post variable is being sent to the
page test.py. then the test.py retrieves the POST and print it to the
page. now everything is great except one thing.

lets say i submitted the form and went to test.py and the output was
correct, then, while i'm on test.py if i reload the page, the POST
variable IS STILL THERE.

so the output is always the POST retrieven at first. So the page keeps
on printing the POST variable retrieven at first even thought i might
have reloaded the page 1000 times. Is there any way to "empty" the
POST variable, so that at reload nothing would be the same?

ps: so many "so" and wacky explanation, noone would understand :(.
5 Answers

Diez B. Roggisch

1/28/2008 6:48:00 PM

0

pavloutefkros@gmail.com schrieb:
> sorry for creating a new post but this is totally different from the
> previous one.
>
> Here is the problem (which is very hard to explain, so i will use a
> paradigm): i submit a form and the post variable is being sent to the
> page test.py. then the test.py retrieves the POST and print it to the
> page. now everything is great except one thing.
>
> lets say i submitted the form and went to test.py and the output was
> correct, then, while i'm on test.py if i reload the page, the POST
> variable IS STILL THERE.
>
> so the output is always the POST retrieven at first. So the page keeps
> on printing the POST variable retrieven at first even thought i might
> have reloaded the page 1000 times. Is there any way to "empty" the
> POST variable, so that at reload nothing would be the same?
>
> ps: so many "so" and wacky explanation, noone would understand :(.

If you are reloading a page, the variables that were sent to it are
re-send by the browser. I fail to see where the problem is. Reloading
means reloading.

Diez

Hrvoje Niksic

1/28/2008 8:35:00 PM

0

"pavloutefkros@gmail.com" <pavloutefkros@gmail.com> writes:

> so the output is always the POST retrieven at first. So the page
> keeps on printing the POST variable retrieven at first even thought
> i might have reloaded the page 1000 times. Is there any way to
> "empty" the POST variable, so that at reload nothing would be the
> same?

Have test.py send a redirect to another page (or to itself, sans the
params). Then reloading won't resend the POST params.

pavloutefkros@gmail.com

1/28/2008 9:33:00 PM

0

1. yes i've tried that technique but its annoying, the user can easily
stop the redirection and not "elegant".

2. yes i'm aware of that, however what i've mentioned above is just an
example, it's actually way more serious.

guess i'll have to bare with it.

bruno.desthuilliers@gmail.com

1/28/2008 10:21:00 PM

0

On 28 jan, 22:32, "pavloutefk...@gmail.com" <pavloutefk...@gmail.com>
wrote:
> 1. yes i've tried that technique but its annoying, the user can easily
> stop the redirection and not "elegant".

It's a very canonical technique with HTTP (at least after a successful
POST). But I suspect you're not doing it the right way, since you're
talking about "the user (...) stop(ing) the redirection".
"Redirecting" here means "sending an HTTP redirection status code and
the appropriate location header" (according to the rfc, code should be
303, but for legacy reasons it's often a 302). You must indeed *not*
have send *anything* else to the client before (which means that you'd
better use a log file to trace your code) !

Gabriel Genellina

1/29/2008 12:16:00 AM

0

En Mon, 28 Jan 2008 19:32:45 -0200, pavloutefkros@gmail.com
<pavloutefkros@gmail.com> escribió:

> 1. yes i've tried that technique but its annoying, the user can easily
> stop the redirection and not "elegant".
>
> 2. yes i'm aware of that, however what i've mentioned above is just an
> example, it's actually way more serious.

See this sequence:

User POSTs a form
Web app processes the form.
Web app updates its internal state.
Web app don't output anything, and finishes the POST handling with a
redirect (implicit GET)

Browser receives the redirect and issues a GET request
Web app returns content

The important thing is that a POST request *never* returns content, always
redirects. All content is retrieved using GET.

--
Gabriel Genellina