Check for presence of cache directory

master
Bob Mottram 2019-08-20 22:26:24 +01:00
parent 6fae77f138
commit eac1ffe993
1 changed files with 5 additions and 4 deletions

View File

@ -23,10 +23,11 @@ def storePersonInCache(baseDir: str,personUrl: str,personJson: {},personCache: {
return
# store to file
cacheFilename=baseDir+'/cache/actors/'+personUrl.replace('/','#')+'.json'
if not os.path.isfile(cacheFilename):
with open(cacheFilename, 'w') as fp:
commentjson.dump(personJson, fp, indent=4, sort_keys=False)
if os.path.isdir(baseDir+'/cache/actors'):
cacheFilename=baseDir+'/cache/actors/'+personUrl.replace('/','#')+'.json'
if not os.path.isfile(cacheFilename):
with open(cacheFilename, 'w') as fp:
commentjson.dump(personJson, fp, indent=4, sort_keys=False)
def getPersonFromCache(baseDir: str,personUrl: str,personCache: {}) -> {}:
"""Get an actor from the cache