[jifty-devel] validator and filter order

Jesse Vincent jesse at bestpractical.com
Fri Jan 5 14:21:36 EST 2007




On Wed, Jan 03, 2007 at 08:12:54PM +0000, John Green wrote:
> Hi,
> 
> I have an IP address which I store in the database as an unsigned 32  
> bit int.
> 
> I have added a validator to check it against RE{net}{IPv4} and also a  
> filter to convert between dotted quad string and 32 bit unsigned  
> integer (and back again).
> 
> Using the admin mode this worked fine when creating a new record, but  
> fails when I try to save a record I have edited.  It appears to be  
> calling the validator after the filter has been applied.

That's intentional. (Though I don't know why create is failing)
Canonicalizers put data in its preferred form. Validators make sure that
what goes into the database is sane. You don't want to validate and then
canonicalize...it might mess up your database.  Does that make sense?


> 
> Is this the intended behaviour (if it is, the difference between the  
> create and update behaviour seems wrong)?
> 
> Or am I going about this the completely wrong way (perhaps by  
> subclassing Jifty::Web::Form::Field and using render_as)?
> 
> Thanks in advance,
> 
> John
> 
> 
> _______________________________________________
> jifty-devel mailing list
> jifty-devel at lists.jifty.org
> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
> 

-- 


More information about the jifty-devel mailing list