Francois Gouget : testbot/Users: Turn the DeleteNonPermanentSessions() method into a function.

Alexandre Julliard julliard at winehq.org
Wed Apr 3 14:29:50 CDT 2013


Module: tools
Branch: master
Commit: e90220247e4612c26bb8b8f7b2be7bbd4f2e3644
URL:    http://source.winehq.org/git/tools.git/?a=commit;h=e90220247e4612c26bb8b8f7b2be7bbd4f2e3644

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Wed Apr  3 16:58:57 2013 +0200

testbot/Users: Turn the DeleteNonPermanentSessions() method into a function.

Methods should not add filters to the collection they are called on.

---

 testbot/lib/WineTestBot/CGI/Sessions.pm |   12 ++++++------
 1 files 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;




More information about the wine-cvs mailing list