[web] Do not try to rmtree symlinks in rmtreecontent() 3.25
authorDenis Laxalde <denis.laxalde@logilab.fr>
Thu, 13 Apr 2017 13:57:32 +0200
branch3.25
changeset 12159 8a1306c43656
parent 12158 241bb09c67f7
child 12160 608481168432
[web] Do not try to rmtree symlinks in rmtreecontent() There is a symlink in data directory (created by generate_static_dir() method) and trying to rmtree() it will fail with an OSError. So we unlink() it instead.
cubicweb/web/webctl.py
--- a/cubicweb/web/webctl.py	Thu Apr 13 12:20:30 2017 +0200
+++ b/cubicweb/web/webctl.py	Thu Apr 13 13:57:32 2017 +0200
@@ -44,7 +44,7 @@
        itself)"""
     for fname in os.listdir(dst):
         fpath = osp.join(dst, fname)
-        if osp.isfile(fpath):
+        if osp.isfile(fpath) or osp.islink(fpath):
             os.unlink(fpath)
         else:
             rmtree(fpath)