From bf90c228c6ac86e01125fc78973f503078e838d5 Mon Sep 17 00:00:00 2001 From: j Date: Fri, 9 May 2008 19:30:54 +0200 Subject: [PATCH] never get new version with timeout -1 --- oxutils/cache.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oxutils/cache.py b/oxutils/cache.py index 5e5169a..00030dc 100644 --- a/oxutils/cache.py +++ b/oxutils/cache.py @@ -85,13 +85,13 @@ def getUrlCacheFile(url, data=None, headers=DEFAULT_HEADERS): return os.path.join(getCacheBase(), domain, url_hash[:2], url_hash[2:4], url_hash[4:6], url_hash) def loadUrlCache(url_cache_file, timeout=cache_timeout): - if timeout <= 0: + if timeout == 0: return None if os.path.exists(url_cache_file): ctime = os.stat(url_cache_file).st_ctime now = time.mktime(time.localtime()) file_age = now-ctime - if file_age < timeout: + if timeout < 0 or file_age < timeout: f = open(url_cache_file) data = f.read() f.close()