changeset 996:56630879fff5

kc store: create the directories where the kch files are to be stored, if necessary
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 28 Oct 2011 17:18:27 -0200
parents 17035a084552
children 3e912ed37167
files MoinMoin/storage/stores/kc.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/storage/stores/kc.py	Fri Oct 28 17:02:24 2011 -0200
+++ b/MoinMoin/storage/stores/kc.py	Fri Oct 28 17:18:27 2011 -0200
@@ -17,7 +17,7 @@
 
 from __future__ import absolute_import, division
 
-import os
+import os, errno
 from StringIO import StringIO
 
 from kyotocabinet import *
@@ -50,6 +50,12 @@
         self.db_opts = db_opts
 
     def create(self):
+        basedir = os.path.dirname(self.path)
+        try:
+            os.makedirs(basedir)
+        except OSError as e:
+            if e.errno != errno.EEXIST:
+                raise
         self.open(mode=self.mode|DB.OCREATE)
         self.close()