On Thu, Jun 3, 2010 at 11:58 PM, Petr Blahos <[email protected]> wrote:
>> > CODE:
>> > When I call validate/index?par1=xxx
>> > fill a non-number into the second text-field and press submit, I get
>> > an exception
>> > on the second line of index.
>>
>> So what is the problem? �...@validate is eating parameters so that they
>> no longer appear in ``requests.params`` or
>> ``request.environ['webob._parsed_post_vars'][0]`` (whatever the latter
>> is)?
>
> First of all, I would like to know, whether my idea that request.params
> should be there is correct.

You called it with "?par1=xxx", so c.par1 should be "xxx" and that
should be the default value in the text box.;

In 'save' decorated with @validate, you'd get the processed variables
from self.form_result. request.params contains the variables as they
were before validating.

> I added some debug prints and found out that the request.params,
> as well as request.POST get cleared after setting
> request.environ['REQUEST_METHOD']
>        if errors:
>            ....
>            request.environ['REQUEST_METHOD'] = 'GET'
>
> They stay in request.environ['webob._parsed_post_vars'][0] though.

Why would you want to set the request method? it should stay as it
originally is so that any following code can find out how the user
submitted the request. Unless you're trying to fool the following code
of course.

Maybe WebOb clears them out because of how it intended REQUEST_METHOD
to be set. If you think it's a bug you can bring it up on the Paste
list.

-- 
Mike Orr <[email protected]>

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

Reply via email to