Small change to the cache file handling.
This commit is contained in:
parent
8a878cea62
commit
dfc8e231af
|
@ -68,9 +68,6 @@ class BlockList:
|
||||||
raw_data = input_list.read()
|
raw_data = input_list.read()
|
||||||
cache_file = open(cache_path, "w+")
|
cache_file = open(cache_path, "w+")
|
||||||
cache_file.write(raw_data)
|
cache_file.write(raw_data)
|
||||||
|
|
||||||
# Rewind the file
|
|
||||||
cache_file.seek(0)
|
|
||||||
except (urllib2.URLError, urllib2.HTTPError), error:
|
except (urllib2.URLError, urllib2.HTTPError), error:
|
||||||
# Network error. Warn and use the cached content.
|
# Network error. Warn and use the cached content.
|
||||||
logging.warning("Reverting to cache file. There was a problem contacting host %s: %s", hostname, error)
|
logging.warning("Reverting to cache file. There was a problem contacting host %s: %s", hostname, error)
|
||||||
|
@ -86,8 +83,8 @@ class BlockList:
|
||||||
cache_file = StringIO.StringIO()
|
cache_file = StringIO.StringIO()
|
||||||
cache_file.write(raw_data)
|
cache_file.write(raw_data)
|
||||||
|
|
||||||
# Rewind the file
|
# Rewind the file
|
||||||
cache_file.seek(0)
|
cache_file.seek(0)
|
||||||
|
|
||||||
# Return the best available data
|
# Return the best available data
|
||||||
return cache_file
|
return cache_file
|
||||||
|
|
Loading…
Reference in a new issue