From 5cdd7c12152e65521a0f23add6de332cd60b46dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonel=20C=C3=A2mara?= Date: Wed, 1 Apr 2015 18:27:05 +0100 Subject: [PATCH] Fixes issue with locked files during cleanup --- gluon/admin.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gluon/admin.py b/gluon/admin.py index 33bc2d7a..602786dd 100644 --- a/gluon/admin.py +++ b/gluon/admin.py @@ -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