[Jifty-commit] r5642 - in jifty/trunk: . lib/Jifty

Jifty commits jifty-commit at lists.jifty.org
Fri Aug 1 14:16:23 EDT 2008


Author: trs
Date: Fri Aug  1 14:16:22 2008
New Revision: 5642

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

Log:
 r38422 at zot:  tom | 2008-08-01 14:14:28 -0400
 Whenever we can (on any action and on record ->creates), pass in the other field values so a validator can base it's validation on those


Modified: jifty/trunk/lib/Jifty/Action.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Action.pm	(original)
+++ jifty/trunk/lib/Jifty/Action.pm	Fri Aug  1 14:16:22 2008
@@ -962,12 +962,12 @@
     if ( $field_info->{validator}
         and defined &{ $field_info->{validator} } )
     {
-        return $field_info->{validator}->( $self, $value );
+        return $field_info->{validator}->( $self, $value, $self->argument_values );
     }
 
     # Check to see if it's the validate_$field method instead and use that
     elsif ( $self->can($default_validator) ) {
-        return $self->$default_validator( $value );
+        return $self->$default_validator( $value, $self->argument_values );
     }
 
     # If none of the checks have failed so far, then it's ok

Modified: jifty/trunk/lib/Jifty/Action/Record.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Action/Record.pm	(original)
+++ jifty/trunk/lib/Jifty/Action/Record.pm	Fri Aug  1 14:16:22 2008
@@ -337,7 +337,7 @@
 
             # Check the column's validator
             my ( $is_valid, $message )
-                = &{ $column->validator }( $self->record, $value );
+                = &{ $column->validator }( $self->record, $value, @_ );
 
             # The validator reported valid, return OK
             return $self->validation_ok($field) if ($is_valid);

Modified: jifty/trunk/lib/Jifty/Record.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Record.pm	(original)
+++ jifty/trunk/lib/Jifty/Record.pm	Fri Aug  1 14:16:22 2008
@@ -80,7 +80,8 @@
         my $attr = $attribs{$key};
         my ( $val, $msg ) = $self->run_validation_for_column(
             column => $key,
-            value  => $attribs{$key}
+            value  => $attribs{$key},
+            extra  => [\%attribs],
         );
         if ( not $val ) {
             $self->log->error("There was a validation error for $key");


More information about the Jifty-commit mailing list