I don't know of any way to force 302 Location to be followed with a
POST, as far as I know all the browsers will issue a GET.
Some browser will follow 307 with the same kind of request they issued
at first, but in that case you won't be able to change the arguments.

The first two solutions that I can think of are:

1) Encode the dict with pickle and base64 and pass it as a get
argument, users won't care much about a parameter they don't
understand. Pay attention that this has a length limit.

2) Put the message inside the session and redirect without any argument.

On Thu, Aug 11, 2011 at 9:31 AM, David Borsodi <[email protected]> wrote:
> This is not the case, but I also misinterpreted something.
> The real problem is, that when I execute an action that redirects to a
> page, like this:
>    @expose()
>    @require(not_anonymous())
>    def updateProfile(self, **kw):
>        try:
>            userOperations.updateUserData(**kw)
>            msg={'main':'Update was successful.'}
>        except Exception, ex:
>            msg =ex.args[0]
>        redirect(url('/myprofile/profile', messages = msg))
>
> i get an HTTP GET. the msg dictionary is sent as a string, causing
> unexpected behavior.
> How can I redirect with post? Or if it is impossible, what is an
> adequate solution to this problem?
>
> david
>
> On Aug 10, 9:27 am, Tamas Hegedus <[email protected]> wrote:
>> Hi,
>>
>> I think that something is not clear or clean :-)
>>
>> The variable in the link is present not because of the "return
>> dict(...)", but because of the submitted form in the previous page,
>> which directs to renewpassword_1... The form in the previous page most
>> likely have the action="renewpassword_1" and no method="POST" is set.
>>
>> Tamas
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> David Borsodi wrote:
>> > Hello
>>
>> > I'd like to ask that how can I send the data given in an exposed
>> > controller method as a 'post'.
>> > E.g. if I have this:
>> >     @expose('mutdb.templates.renewpassword_1')
>> >     def renewpassword_1(self, **kw):
>> >         return dict(page='rewnewpassword_1', state=kw.get('state',
>> > 'pre'))
>>
>> > I get the following url after execution, what looks like an HTTP GET:
>> >http://localhost:8080/renewpassword_1?state=pre
>> > which is sometimes unacceptable (eg in case of returning an sql
>> > resultset) and usually not elegant.
>>
>> > So, is there any way to post the dictionary ?
>>
>> > thanks
>> > david
>>
>> --
>> Tamas Hegedus, PhD
>> Membrane Research Group        | phone: (36) 1-459 1500/60233
>> Hungarian Academy of Sciences  | fax:   (36) 1-266 6656
>> Tuzolto utca 37-47             | mailto:[email protected]
>> Budapest, 1094, Hungary        |http://www.hegelab.org
>
> --
> You received this message because you are subscribed to the Google Groups 
> "TurboGears" 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/turbogears?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en.

Reply via email to