From b04cbc6d9af9bce410311a5bda10e014c9044e8a Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sun, 3 May 2009 23:40:28 +0200 Subject: [PATCH] entropy.client.mirrors.StatusInterface: add two new methods. Add set_working_mirror and add_failing_working_mirror methods with the aim of increasing the usefulness of the class. --- libraries/entropy/client/mirrors.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libraries/entropy/client/mirrors.py b/libraries/entropy/client/mirrors.py index 4795df324..1a69bd71e 100644 --- a/libraries/entropy/client/mirrors.py +++ b/libraries/entropy/client/mirrors.py @@ -23,6 +23,7 @@ class StatusInterface(dict): def __init__(self): + self.__last_mirrorname = None dict.__init__(self) def add_failing_mirror(self, mirrorname, increment = 1): @@ -36,3 +37,14 @@ class StatusInterface(dict): def set_failing_mirror_status(self, mirrorname, value): self[mirrorname] = value + + def set_working_mirror(self, mirrorname): + self.__last_mirrorname = mirrorname + + def add_failing_working_mirror(self, value): + if self.__last_mirrorname: + self.add_failing_mirror(self.__last_mirrorname, value) + + def clear(self): + self.__last_mirrorname = None + return dict.clear(self) \ No newline at end of file