From 7e3d8ce54bd9bca910be3ee98949c050cb048784 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sat, 30 Aug 2014 20:50:55 +0530 Subject: [PATCH] Use os.mkdirs instead of custom method --- plinth/modules/santiago/santiago.py | 2 +- plinth/util.py | 23 ----------------------- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/plinth/modules/santiago/santiago.py b/plinth/modules/santiago/santiago.py index e9339fe55..d07b713a2 100644 --- a/plinth/modules/santiago/santiago.py +++ b/plinth/modules/santiago/santiago.py @@ -43,7 +43,7 @@ class Santiago(PagePlugin): self.santiago_dir = os.path.join(cfg.file_root, "data", "santiago", "tor") self.tor_dir = os.path.join(self.santiago_dir, "general") - u.mkdir(self.santiago_dir) + os.mkdirs(self.santiago_dir) os.system( 'chmod a+w %s' % self.santiago_dir) hidden_service_config = "HiddenServiceDir %s\nHiddenServicePort 80 127.0.0.1:%d" % (self.tor_dir, santiago_port) if hidden_service_config in rc: diff --git a/plinth/util.py b/plinth/util.py index b593fb8d8..592725f03 100644 --- a/plinth/util.py +++ b/plinth/util.py @@ -1,26 +1,3 @@ -import os - - -def mkdir(newdir): - """works the way a good mkdir should :) - - already exists, silently complete - - regular file in the way, raise an exception - - parent directory(ies) does not exist, make them as well - """ - if os.path.isdir(newdir): - pass - elif os.path.isfile(newdir): - raise OSError("a file with the same name as the desired " \ - "dir, '%s', already exists." % newdir) - else: - head, tail = os.path.split(newdir) - if head and not os.path.isdir(head): - mkdir(head) - #print "mkdir %s" % repr(newdir) - if tail: - os.mkdir(newdir) - - def slurp(filespec): with open(filespec) as x: f = x.read() return f