On Fri, Oct 23, 2009 at 2:31 PM, Thomas G. Willis <[email protected]> wrote:
>
> On Oct 23, 4:54 pm, Mike Orr <[email protected]> wrote:
>> On Sun, Oct 11, 2009 at 1:53 PM, Jonathan Vanasco <[email protected]> 
>> wrote:
>
>> This is one of the problems with @validate; it's not flexible enough
>> for this situation.  The developers are mulling over ways to rewrite
>> it or replace it.
>>
>
>> --
>> Mike Orr <[email protected]>
>
> What's been discussed so far?  I've been thinking about this a lot
> lately because validation is tedious(obviously) but I have yet to find
> a less tedious solution. I'd be interested in hearing what the smart
> guys are kicking around though.

Originally there was a plan to split it into three parts, with
@validate calling the parts in order for compatibility.

http://pylonshq.com/project/pylonshq/ticket/405

Since then, there has been discussion about just leaving the decorator
as-is and writing some utility functions for the controller, or
promoting WTForms (http://wtforms.simplecodes.com/), or adding more
support for one-method form handling (doing form & validation in the
same method).

I was initially enthusiastic about WTForms but I think it may be too
big a jump for Pylons.  (That doesn't mean you can't use it, or that
it shouldn't have a Pylons Howto eventually.)

There's a lot to be said for doing the form and validation in the same
action.  Something like:

if request.POST:
    if not validation-errors:
        do action and return success page or redirect
display form(maybe with data and errors)

I always did this until I came to Pylons.  It avoids the need for a
decorator.  I've been using @validate because the Pylons tradition is
to have separate methods for the form and validation, but I'm
beginning to wonder if it's worth it.  I'd like to add a map.resource
method that uses one-method form handling, to make it easier to do.

-- 
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