38 messages in com.googlegroups.pylons-discussRe: An idea for improving @validate
FromSent OnAttachments
Steven Holmes28 Jan 2008 17:33 
Mike Orr28 Jan 2008 22:33 
Alberto Valverde29 Jan 2008 00:35 
Steven Holmes29 Jan 2008 01:44 
Qiangning Hong29 Jan 2008 03:01 
Dmitry Lipovoi29 Jan 2008 03:05 
Steven Holmes29 Jan 2008 03:27 
Mike Orr29 Jan 2008 08:21 
Steven Holmes29 Jan 2008 08:43 
Matt Feifarek29 Jan 2008 08:52 
Steven Holmes29 Jan 2008 09:05 
Ian Bicking29 Jan 2008 09:40 
Mike Orr29 Jan 2008 10:50 
Ian Bicking29 Jan 2008 11:14 
Mike Orr29 Jan 2008 11:25 
Matt Feifarek29 Jan 2008 11:35 
Ian Bicking29 Jan 2008 11:45 
Mike Orr29 Jan 2008 12:32 
Ian Bicking29 Jan 2008 12:46 
Ben Bangert29 Jan 2008 12:56 
Ben Bangert29 Jan 2008 12:57 
Ben Bangert29 Jan 2008 13:05 
Ian Bicking29 Jan 2008 13:05 
Philip Jenvey29 Jan 2008 13:10 
Philip Jenvey29 Jan 2008 13:10 
Matt Feifarek29 Jan 2008 13:11 
Ben Bangert29 Jan 2008 13:19 
Ian Bicking29 Jan 2008 13:26 
Ben Bangert29 Jan 2008 13:38 
Mike Orr29 Jan 2008 14:51 
Steven Holmes29 Jan 2008 14:54 
Mike Orr29 Jan 2008 15:00 
Mike Orr29 Jan 2008 15:17 
Ian Bicking29 Jan 2008 15:27 
Ben Bangert29 Jan 2008 15:59 
Ian Bicking29 Jan 2008 16:05 
Mike Orr29 Jan 2008 16:09 
Steven Holmes29 Jan 2008 17:07 
Subject:Re: An idea for improving @validate
From:Steven Holmes (steg@public.gmane.org)
Date:01/29/2008 09:05:12 AM
List:com.googlegroups.pylons-discuss

On 29 Jan 2008, at 16:53, Matt Feifarek wrote:

On Jan 29, 2008 11:21 AM, Mike Orr
<slug@public.gmane.org> wrote:

Yes, we're disagreeing on what the default should be. Well, you'll have to convince Ben. I think he likes it the other way.

I don't have this particular religion, but what would a REST zealot say? Seems like two different URI's for the same thing is bad.

I've hacked up my base controller class to make it work the way that Steven wants. I suppose to me, clean URIs are better than clean controllers. And in my case, the "mess" isn't in my controllers, it's in my base controller class.

Plus, I'm not sure that decorators make things cleaner; it just puts some mysterious magic in my code. @validate is pretty easy to understand magic, but it's still one little line that completely changes the expected dispatch behavior of pylons (one url = one request = one route = one action = one method = one response). I don't like 'em.

I'm not a fan of @validate either, as a general rule. I like being able to select schemas at request time (for things like a CRUDController it lets me have subclasses with things like create_schema = <foo>). However, I can see that @validate would be very useful for a significant number of common cases.

The ideal way to handle forms, in my opinion, is to always redirect after a POST. If there are errors, save the Invalid exception and redirect to the referrer. This allows form actions to be targeted by multiple forms in different places. (The usual example I give of this is adding products to a shopping cart--I want to be able to have the add form both on the product summary and on the full product page. Redirecting to referer automatically does the right thing).