[Jifty-commit] r2010 - in jifty/trunk: lib/Jifty

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Tue Oct 10 00:33:47 EDT 2006


Author: jesse
Date: Tue Oct 10 00:33:44 2006
New Revision: 2010

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Record.pm

Log:
 r28332 at pinglin:  jesse | 2006-10-10 00:16:59 -0400
 * We were not properly removing blank values on create 


Modified: jifty/trunk/lib/Jifty/Record.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Record.pm	(original)
+++ jifty/trunk/lib/Jifty/Record.pm	Tue Oct 10 00:33:44 2006
@@ -70,21 +70,20 @@
     foreach my $key ( keys %attribs ) {
         my $attr = $attribs{$key};
         my $method = "validate_$key";
-        my $func = $self->can($method) or next;
+        if (my $func = $self->can($method)) {
         my ( $val, $msg ) = $func->($self, $attr);
         unless ($val) {
             $self->log->error("There was a validation error for $key");
             return ( $val, $msg );
         }
-
+        }
         # remove blank values. We'd rather have nulls
-        if ( exists $attribs{$key}
-            and ( not defined $attr or (not ref $attr and $attr eq "" )) )
-        {
+        if ( exists $attribs{$key} and ( not ref( $attr) and $attr eq '' )) {
             delete $attribs{$key};
         }
     }
 
+
     my $msg = $self->SUPER::create(%attribs);
     if (ref($msg)  ) {
         # It's a Class::ReturnValue


More information about the Jifty-commit mailing list