Skip to content

Commit

Permalink
create all dirs if root doesn't exist
Browse files Browse the repository at this point in the history
* Use os.makedirs instead of os.mkdir
* Use os.path.abspath to get rid of eventual '..' elements
  • Loading branch information
serverhorror committed Mar 8, 2011
1 parent ee7cbe5 commit 87a142d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion web/session.py
Expand Up @@ -4,6 +4,7 @@
"""

import os, time, datetime, random, base64
import os.path
try:
import cPickle as pickle
except ImportError:
Expand Down Expand Up @@ -217,7 +218,9 @@ class DiskStore(Store):
def __init__(self, root):
# if the storage root doesn't exists, create it.
if not os.path.exists(root):
os.mkdir(root)
os.makedirs(
os.path.abspath(root)
)
self.root = root

def _get_path(self, key):
Expand Down

0 comments on commit 87a142d

Please sign in to comment.