--- a/server/sources/ldapuser.py Mon Mar 09 12:12:53 2009 +0100
+++ b/server/sources/ldapuser.py Tue Mar 10 11:35:52 2009 +0100
@@ -20,7 +20,7 @@
FOR A PARTICULAR PURPOSE.
"""
-from mx.DateTime import now, DateTimeDelta
+from datetime import datetime, timedelta
from logilab.common.textutils import get_csv
from rql.nodes import Relation, VariableRef, Constant, Function
@@ -53,16 +53,16 @@
class TimedCache(dict):
def __init__(self, ttlm, ttls=0):
# time to live in minutes
- self.ttl = DateTimeDelta(0, 0, ttlm, ttls)
+ self.ttl = timedelta(0, ttlm*60 + ttls, 0)
def __setitem__(self, key, value):
- dict.__setitem__(self, key, (now(), value))
+ dict.__setitem__(self, key, (datetime.now(), value))
def __getitem__(self, key):
return dict.__getitem__(self, key)[1]
def clear_expired(self):
- now_ = now()
+ now_ = datetime.now()
ttl = self.ttl
for key, (timestamp, value) in self.items():
if now_ - timestamp > ttl: