and do not fail for new files

This commit is contained in:
j 2008-03-19 13:58:48 +00:00
parent cf955e4e9f
commit 963d95ec0d

View file

@ -22,16 +22,15 @@ def read_url(url):
cache_file = "%sindex.html" % cache_file
if os.path.isdir(cache_file):
cache_file = os.path.join(cache_file, "index.html")
if os.path.exists(cache_file):
ctime = os.stat(cache_file).st_ctime
now = time.mktime(time.localtime())
file_age = now-ctime
print cache_timeout-file_age
if file_age < cache_timeout and os.path.exists(cache_file):
if file_age < cache_timeout:
f = open(cache_file)
data = f.read()
f.close()
return data
else:
data = utils.read_url(url)
folder = os.path.dirname(cache_file)
if not os.path.exists(folder):