diff options
author | groditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-02-29 21:25:14 +0000 |
---|---|---|
committer | groditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-02-29 21:25:14 +0000 |
commit | 335754e0e6a978284ab11afcc9c3d9da237df52c (patch) | |
tree | 9219507daeb4f60ef410dd1679ea74ae77863998 /lib/Reaction/InterfaceModel | |
parent | 2e99390063c9dc46cf295e7e0b56e286f01f6ddc (diff) | |
download | reaction-335754e0e6a978284ab11afcc9c3d9da237df52c.tar.gz reaction-335754e0e6a978284ab11afcc9c3d9da237df52c.zip |
fix for error in changeset 647 in regards to value checking in non-required attrs
Diffstat (limited to 'lib/Reaction/InterfaceModel')
-rw-r--r-- | lib/Reaction/InterfaceModel/Action.pm | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/Reaction/InterfaceModel/Action.pm b/lib/Reaction/InterfaceModel/Action.pm index e6b06da..52b94f8 100644 --- a/lib/Reaction/InterfaceModel/Action.pm +++ b/lib/Reaction/InterfaceModel/Action.pm @@ -60,18 +60,18 @@ class Action which { implements error_for_attribute => as { my ($self, $attr) = @_; + my $reader = $attr->get_read_method; + my $predicate = $attr->predicate; if ($self->attribute_is_required($attr)) { - if ($attr->has_valid_values) { - my $reader = $attr->get_read_method; - unless ($attr->check_valid_value($self, $self->$reader)) { - return "Not a valid value for ".$attr->name; - } - } - my $predicate = $attr->predicate; unless ($self->$predicate) { return $attr->name." is required"; } } + if ($self->$predicate && $attr->has_valid_values) { + unless ($attr->check_valid_value($self, $self->$reader)) { + return "Not a valid value for ".$attr->name; + } + } return; # ok }; |