appobject.py
changeset 2144 51c84d585456
parent 2059 af33833d7571
parent 2099 0cba78f4fa12
child 2476 1294a6bdf3bf
--- a/appobject.py	Tue Jun 23 13:31:35 2009 +0200
+++ b/appobject.py	Tue Jun 23 13:36:38 2009 +0200
@@ -25,8 +25,9 @@
 class Cache(dict):
     def __init__(self):
         super(Cache, self).__init__()
-        self.cache_creation_date = None
-        self.latest_cache_lookup = datetime.now()
+        _now = datetime.now()
+        self.cache_creation_date = _now
+        self.latest_cache_lookup = _now
 
 CACHE_REGISTRY = {}
 
@@ -127,8 +128,7 @@
         if cachename in CACHE_REGISTRY:
             cache = CACHE_REGISTRY[cachename]
         else:
-            cache = Cache()
-            CACHE_REGISTRY[cachename] = cache
+            cache = CACHE_REGISTRY[cachename] = Cache()
         _now = datetime.now()
         if _now > cache.latest_cache_lookup + ONESECOND:
             ecache = self.req.execute('Any C,T WHERE C is CWCache, C name %(name)s, C timestamp T',