This won't work with an external site, but assuming www.paypal.com/
xxxx was just the
first link you thought of, you might try this:
1. User goes to site, and says, "Oh, I'd like to post a comment" and
so he does
2. Web Application says, "Umm.. you need to be logged in to do that"
But, the web application also says, "I'm going to let you go
login, but let me save that
data you sent me for the post-login redirect"
3. Server saves the POSTed data to a file, with a long random name,
and constructs a
redirect to the login page, setting up a post-login redirect
with that filename attached
(There are potential security holes with this post-login
redirect, which can be solved
via a whitelist of urls, or putting the url in a session [which
introduces a race condition],
or, making it tamper proof by adding another parameter that is
the sha1(secret string +
url), that is verified before the actual redirect)
4. User logs in correctly
5. Server sees (via some middleware I'm guessing) that there's some
POST data being
being submitted, and so it loads it up. This is the tricky part.
After login, you issued a
GET for the redirect, but your original "/comments/add" only
responds to POST. Well,
perhaps the only thing you can do is add a GET /comments/add
which does nothing
if there's no saved POST data, and "pretends" to be POST by
calling POST if there is.
6. User doesn't have to retype in his comment, and comes back again.
Maybe this helps?
On Jan 28, 2009, at 11:56 PM, [email protected] wrote:
> i want to do something like this:
>
> web.redirect('http://www.paypal.com/xxxx')
> but this will be a GET redirect. I want to do a POST redirect with
> data.
>
> On Wed, Jan 28, 2009 at 8:40 PM, Brent Pedersen
> <[email protected]> wrote:
>
> GET and POST are just methods. so you can just call POST()
>
> ##########################
> import web
>
> urls = ("/", "hello")
> app = web.application(urls, globals())
>
> class hello:
> def GET(self):
> return self.POST()
>
> def POST(self):
> return 'Hello, POST world!'
>
> if __name__ == "__main__":
> app.run()
>
>
> On Wed, Jan 28, 2009 at 8:00 PM, [email protected]
> <[email protected]> wrote:
> > is it possible to redirect a URL as a POST method instead of GET?
> >
> >
> > thanks a lot!!
> > >
> >
>
>
>
> >
--
http://www.apgwoz.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---