[07/10] testbot/Users: Turn the DeleteNonPermanentSessions() method into a function.
Francois Gouget
fgouget at codeweavers.com
Wed Apr 3 09:58:57 CDT 2013
Methods should not add filters to the collection they are called on.
---
testbot/lib/WineTestBot/CGI/Sessions.pm | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/testbot/lib/WineTestBot/CGI/Sessions.pm b/testbot/lib/WineTestBot/CGI/Sessions.pm
index 6cf8b71..97e33b5 100644
--- a/testbot/lib/WineTestBot/CGI/Sessions.pm
+++ b/testbot/lib/WineTestBot/CGI/Sessions.pm
@@ -75,14 +75,14 @@ sub CreateItem
return WineTestBot::CGI::Session->new($self);
}
-sub DeleteNonPermanentSessions
+sub DeleteNonPermanentSessions($)
{
- my $self = shift;
my $User = $_[0];
- $self->AddFilter("User", [$User]);
- $self->AddFilter("Permanent", [!1]);
- map { $self->DeleteItem($_); } @{$self->GetItems()};
+ my $Sessions = CreateSessions();
+ $Sessions->AddFilter("User", [$User]);
+ $Sessions->AddFilter("Permanent", [!1]);
+ map { $Sessions->DeleteItem($_); } @{$Sessions->GetItems()};
}
sub NewSession
@@ -90,7 +90,7 @@ sub NewSession
my $self = shift;
my ($User, $Permanent) = @_;
- CreateSessions()->DeleteNonPermanentSessions($User);
+ DeleteNonPermanentSessions($User);
my $Session = $self->Add();
my $Existing = $Session;
--
1.7.10.4
More information about the wine-patches
mailing list