changeset 2930:dc0f45b10ae6

fix os.path.exists() vs. os.makedirs() race
author Johannes Berg <johannes AT sipsolutions DOT net>
date Mon, 29 Oct 2007 17:40:57 +0100
parents 0ca160b0e5d2
children fff3e18fb5e4
files MoinMoin/Page.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Page.py	Mon Oct 29 17:42:02 2007 +0100
+++ b/MoinMoin/Page.py	Mon Oct 29 17:40:57 2007 +0100
@@ -482,8 +482,11 @@
                 dirname, filename = os.path.split(fullpath)
             else:
                 dirname = fullpath
-            if not os.path.exists(dirname):
+            try:
                 os.makedirs(dirname)
+            except OSError, err:
+                if not os.path.exists(dirname):
+                    raise err
         return underlay, fullpath
 
     def getPagePath(self, *args, **kw):