Fixes issue with locked files during cleanup

This commit is contained in:
Leonel Câmara
2015-04-01 18:27:05 +01:00
parent 0aade6b378
commit 5cdd7c1215

View File

@@ -114,17 +114,18 @@ def app_cleanup(app, request):
for f in os.listdir(path):
try:
if f[:1] != '.': recursive_unlink(os.path.join(path, f))
except IOError:
except (OSError, IOError):
r = False
# Remove cache files
CacheOnDisk(folder=apath('%s/cache/' % app, request)).clear()
path = apath('%s/cache/' % app, request)
CacheOnDisk(folder=path).clear()
if os.path.exists(path):
for f in os.listdir(path):
try:
if f[:1] != '.': recursive_unlink(os.path.join(path, f))
except IOError:
except (OSError, IOError):
r = False
return r