[Pkg-nagios-changes] [SCM] UNNAMED PROJECT branch, debian/master, updated. 810edbdd3feedbfe37f4a65bee50b57b2f60fa2a

Gerhard Lausser gerhard.lausser at consol.de
Tue Feb 28 22:21:00 UTC 2012


The following commit has been merged in the debian/master branch:
commit 7cb1dcc1d945eac6ab12a346625b533057f69f72
Author: Gerhard Lausser <gerhard.lausser at consol.de>
Date:   Wed Feb 15 15:21:11 2012 +0100

    Add support for python 2.4 to licestatus cache

diff --git a/shinken/modules/livestatus_broker/livestatus_query_cache.py b/shinken/modules/livestatus_broker/livestatus_query_cache.py
index bbc6487..2fa50ae 100644
--- a/shinken/modules/livestatus_broker/livestatus_query_cache.py
+++ b/shinken/modules/livestatus_broker/livestatus_query_cache.py
@@ -74,7 +74,19 @@ class Counter(dict):
     """
     This is a special kind of dictionary. It is used to store the usage number
     for each key. For non-existing keys it simply returns 0.
+    Methods __init__ and __getitem__ are only needed until that happy day
+    when we finally get rid of Python 2.4
     """
+    def __init__(self, default_factory=None, *a, **kw): 
+        dict.__init__(self, *a, **kw) 
+ 
+    def __getitem__(self, key): 
+        try: 
+            return dict.__getitem__(self, key) 
+        except KeyError: 
+            self[key] = 0
+            return self.__missing__(key) 
+
     def __missing__(self, key):
         return 0
 

-- 
UNNAMED PROJECT



More information about the Pkg-nagios-changes mailing list