Commit 9d762778 authored by Sam Ruby's avatar Sam Ruby

Pull in Joe's fix for to consistently create the http cache directory

parents 0c88af96 51c80375
......@@ -294,6 +294,8 @@ def http_cache_directory():
if parser.has_option('Planet', 'http_cache_directory'):
os.path.join(cache_directory(),
parser.get('Planet', 'http_cache_directory'))
else:
return os.path.join(cache_directory(), "cache")
def cache_sources_directory():
if parser.has_option('Planet', 'cache_sources_directory'):
......
......@@ -355,11 +355,13 @@ def spiderPlanet(only_if_new = False):
parse_queue = Queue()
threads = {}
if int(config.spider_threads()):
http_cache = config.http_cache_directory()
if http_cache and not os.path.exists(http_cache):
os.makedirs(http_cache, 0700)
http_cache = config.http_cache_directory()
# Should this be done in config?
if http_cache and not os.path.exists(http_cache):
os.makedirs(http_cache)
if int(config.spider_threads()):
# Start all the worker threads
for i in range(int(config.spider_threads())):
threads[i] = Thread(target=httpThread,
......
......@@ -83,7 +83,7 @@ class SpiderTest(unittest.TestCase):
files = glob.glob(workdir+"/*")
# verify that exactly eight files + 1 source dir were produced
self.assertEqual(13, len(files))
self.assertEqual(14, len(files))
# verify that the file names are as expected
self.assertTrue(os.path.join(workdir,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment