server/sources/__init__.py
branchstable
changeset 5637 b72a838aa109
parent 5424 8ecbcbff9777
child 5642 6a90357b9769
--- a/server/sources/__init__.py	Sat May 29 10:06:07 2010 +0000
+++ b/server/sources/__init__.py	Wed Jun 02 15:55:58 2010 +0000
@@ -54,7 +54,9 @@
 class TimedCache(dict):
     def __init__(self, ttlm, ttls=0):
         # time to live in minutes
-        self.ttl = timedelta(0, ttlm*60 + ttls, 0)
+        self.ttl = timedelta(seconds=ttlm*60 + ttls)
+        if self.ttl.seconds <= 0:
+            raise ValueError('TimedCache initialized with a ttl of %ss' % self.ttl.seconds)
 
     def __setitem__(self, key, value):
         dict.__setitem__(self, key, (datetime.now(), value))