Hi,
@validate supports separating form rendering and form post processing
into distinct methods. This is convenient, but has a nasty flaw: It
requires two separate URLs, a form display URL and a URL to handle the
post. When a form post fails to validate, the form is re-displayed,
but at the post URL instead of the original form display URL. I find
this inconsistent and broken.
Here is a little example:
class AccountController(BaseController):
def create_form(self):
return render('create_account')
@validate(schema=CreateAccountSchema(), form='create_form')
def create(self):
return 'Account Created!'
To view the form we go to /account/create_form, then when we submit we
are taken to /account/create, where the form is re-displayed if there
were errors. Two different URLs for the same form. This is
unnecessarily exposing a (confusing) implementation detail to the user.
Changing @validate so that it will always internally redirect to
create_form if there is no form post would make things more
consistent. The form could then be viewed at /account/create and also
re-displayed with errors are /account/create, while the nice
separation between form display and form processing is maintained.
I don't know what effect this change would have on backwards
compatibility, but it can be made with a trivial (two lines or so)
change to @validate. (I can do a quick patch if anybody's interested).
Cheers,
Steven
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---