forked from indymedia/epicyon
Check for presence of cache directory
parent
6fae77f138
commit
eac1ffe993
9
cache.py
9
cache.py
|
@ -23,10 +23,11 @@ def storePersonInCache(baseDir: str,personUrl: str,personJson: {},personCache: {
|
||||||
return
|
return
|
||||||
|
|
||||||
# store to file
|
# store to file
|
||||||
cacheFilename=baseDir+'/cache/actors/'+personUrl.replace('/','#')+'.json'
|
if os.path.isdir(baseDir+'/cache/actors'):
|
||||||
if not os.path.isfile(cacheFilename):
|
cacheFilename=baseDir+'/cache/actors/'+personUrl.replace('/','#')+'.json'
|
||||||
with open(cacheFilename, 'w') as fp:
|
if not os.path.isfile(cacheFilename):
|
||||||
commentjson.dump(personJson, fp, indent=4, sort_keys=False)
|
with open(cacheFilename, 'w') as fp:
|
||||||
|
commentjson.dump(personJson, fp, indent=4, sort_keys=False)
|
||||||
|
|
||||||
def getPersonFromCache(baseDir: str,personUrl: str,personCache: {}) -> {}:
|
def getPersonFromCache(baseDir: str,personUrl: str,personCache: {}) -> {}:
|
||||||
"""Get an actor from the cache
|
"""Get an actor from the cache
|
||||||
|
|
Loading…
Reference in New Issue