From dfc8e231afe726668ba4f61bc03c687885c0952b Mon Sep 17 00:00:00 2001 From: Scott Wallace Date: Sat, 13 Jul 2013 08:25:41 +0100 Subject: [PATCH] Small change to the cache file handling. --- blocklist.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/blocklist.py b/blocklist.py index 4c79859..ff56229 100644 --- a/blocklist.py +++ b/blocklist.py @@ -68,9 +68,6 @@ class BlockList: raw_data = input_list.read() cache_file = open(cache_path, "w+") cache_file.write(raw_data) - - # Rewind the file - cache_file.seek(0) except (urllib2.URLError, urllib2.HTTPError), error: # Network error. Warn and use the cached content. 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.write(raw_data) - # Rewind the file - cache_file.seek(0) + # Rewind the file + cache_file.seek(0) # Return the best available data return cache_file