From 52fe4407b8237743ab006dd50d827c995ef1e2aa Mon Sep 17 00:00:00 2001 From: sean Date: Thu, 1 Dec 2016 10:29:23 -0500 Subject: [PATCH] when mkdir of missing app folders, handle broken links properly --- gluon/admin.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gluon/admin.py b/gluon/admin.py index 9615956f..3d8d13c8 100644 --- a/gluon/admin.py +++ b/gluon/admin.py @@ -438,7 +438,11 @@ def add_path_first(path): def try_mkdir(path): if not os.path.exists(path): try: - os.mkdir(path) + if os.path.islink(path): + # path is a broken link, try to mkdir the target of the link instead of the link itself. + os.mkdir(os.path.realpath(path)) + else: + os.mkdir(path) except OSError as e: if e.strerror == 'File exists': # In case of race condition. pass