From c3c3037a1d726f3a1e1b04a3ee0b7d88cf1c5226 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 4 Jan 2013 07:29:23 -0500 Subject: [PATCH] utils: Teach mkdir_p to fail if the existing target isn't a directory Existing symlinks to directories will still pass, because isdir() follows symbolic links. --- pelican/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/utils.py b/pelican/utils.py index 3a41d04e..40406b1a 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -416,5 +416,5 @@ def mkdir_p(path): try: os.makedirs(path) except OSError as e: - if e.errno != errno.EEXIST: + if e.errno != errno.EEXIST or not os.path.isdir(path): raise