Sorry,  I created 2 threads of discussion on the same subject. Please
lets continue the discussion here :-

http://groups.google.ca/group/pylons-discuss/t/a70e07e1a0a4e8e7

On Jun 24, 12:06 pm, afrotypa <ovuaia...@gmail.com> wrote:
> Hi,
>
> I had a question about how @validate works
>
> Say you have /controller/edit
>
> which returns a form in a rendered template whose action is /
> controller/save
>
> As well the save action has an @validate decorator associated with
> edits submitted form i.e. :-
>
> @restrict('POST')
> @validate(schema=TestSchema(), form='edit', post_only=False,
> on_get=True)
> def save(self, id=None):
>
> If TestSchema fails to validate when @validate kicks in, this results
> in edit being called (this looks like a method call not an HTTP get)
> to re-generate the form for htmlfill to render with errors. This is
> all fine an dandy if the select fields for the re-generated form have
> the same options as when the form was initially generated and thus
> there is no need to change the forms select field options.
>
> However if regenerating the form requires a different set of select
> options (which are dependent on the current select fields values
> submitted in the original request), then the 2nd call to 'edit' will
> need access to the request parameters in order to intelligently
> regenerate the form. It appears request.params does not contain the
> request parameters in this case. I was only able to obtain the current
> form values in this case by doing something like this :-
>
> params=dict(request.environ.get('webob._parsed_post_vars')[0])
>
> This however does not look elegant and that variable is not guaranteed
> to remain a part of the api in future webob versions.
>
> Does anyone have an idea about how to handle this issue?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To post to this group, send email to pylons-devel@googlegroups.com
To unsubscribe from this group, send email to 
pylons-devel+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to