Francois Gouget : testbot/web: Standardize the OnAction() methods.
Alexandre Julliard
julliard at winehq.org
Wed Apr 3 14:29:49 CDT 2013
Module: tools
Branch: master
Commit: a7e0a1d56ec80b437d85755631963a642041cc51
URL: http://source.winehq.org/git/tools.git/?a=commit;h=a7e0a1d56ec80b437d85755631963a642041cc51
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Wed Apr 3 16:56:42 2013 +0200
testbot/web: Standardize the OnAction() methods.
Also note that FormPage::Save() sets the 'ErrField' and 'ErrMessage'
properties directly and returns a simple boolean.
---
testbot/lib/ObjectModel/CGI/ItemPage.pm | 9 +++------
testbot/web/admin/UserDetails.pl | 22 +++++++++-------------
2 files changed, 12 insertions(+), 19 deletions(-)
diff --git a/testbot/lib/ObjectModel/CGI/ItemPage.pm b/testbot/lib/ObjectModel/CGI/ItemPage.pm
index a3310ec..16736fe 100644
--- a/testbot/lib/ObjectModel/CGI/ItemPage.pm
+++ b/testbot/lib/ObjectModel/CGI/ItemPage.pm
@@ -157,12 +157,9 @@ sub OnAction
if ($Action eq "OK")
{
- if ($self->Save())
- {
- $self->RedirectToList();
- exit;
- }
- return !1;
+ return !1 if (!$self->Save());
+ $self->RedirectToList();
+ exit;
}
elsif ($Action eq "Cancel")
{
diff --git a/testbot/web/admin/UserDetails.pl b/testbot/web/admin/UserDetails.pl
index f49a522..9e79aa4 100644
--- a/testbot/web/admin/UserDetails.pl
+++ b/testbot/web/admin/UserDetails.pl
@@ -64,21 +64,13 @@ sub GetActions
return \@Actions;
}
-sub OnApprove
+sub OnApprove($)
{
my $self = shift;
- ($self->{ErrField}, $self->{ErrMessage}) = $self->Save();
- if (defined($self->{ErrMessage}))
- {
- return !1;
- }
+ return !1 if (!$self->Save());
$self->{ErrMessage} = $self->{Item}->Approve();
- if (defined($self->{ErrMessage}))
- {
- return !1;
- }
-
+ return !1 if (defined $self->{ErrMessage});
$self->RedirectToList();
exit;
}
@@ -88,8 +80,12 @@ sub OnAction
my $self = shift;
my $Action = $_[0];
- return ($Action eq "Approve" ? $self->OnApprove() :
- $self->SUPER::OnAction(@_));
+ if ($Action eq "Approve")
+ {
+ return $self->OnApprove();
+ }
+
+ return $self->SUPER::OnAction(@_);
}
package main;
More information about the wine-cvs
mailing list