post variable

Discussion in 'Python' started by pavloutefkros@gmail.com, Jan 28, 2008.

  1. Guest

    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 :(.
     
    , Jan 28, 2008
    #1
    1. Advertising

  2. 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
     
    Diez B. Roggisch, Jan 28, 2008
    #2
    1. Advertising

  3. "" <> 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.
     
    Hrvoje Niksic, Jan 28, 2008
    #3
  4. Guest

    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.
     
    , Jan 28, 2008
    #4
  5. Guest

    On 28 jan, 22:32, "" <>
    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) !
     
    , Jan 28, 2008
    #5
  6. En Mon, 28 Jan 2008 19:32:45 -0200,
    <> 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
     
    Gabriel Genellina, Jan 29, 2008
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Oleg
    Replies:
    0
    Views:
    1,204
  2. Sridhar Hegde
    Replies:
    2
    Views:
    2,556
    Ajeetha Kumari
    Sep 13, 2004
  3. Ron

    Variable = Variable? (re post)

    Ron, Jul 21, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    404
  4. mfglinux
    Replies:
    11
    Views:
    737
    Roberto Bonvallet
    Sep 12, 2007
  5. David Filmer
    Replies:
    19
    Views:
    267
    Kevin Collins
    May 21, 2004
Loading...

Share This Page