Skip to content

Commit

Permalink
Merge pull request #60 from c-w/bugfix/mkdirs
Browse files Browse the repository at this point in the history
Fix error: module 'os' has no attribute 'mkdirs'
  • Loading branch information
daknob authored Oct 16, 2017
2 parents 2987c46 + ff68452 commit 60d6e12
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions backends/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ def initialize_backend():
such as connecting to a remote database or making sure a file exists.
"""

try:
os.mkdirs("pastes")
except:
pass
return
os.makedirs("pastes", exist_ok=True)


def new_paste(paste_id, paste_content):
Expand All @@ -36,10 +32,7 @@ def new_paste(paste_id, paste_content):
a = paste_id[0:2]
b = paste_id[2:4]

try:
os.makedirs("pastes/" + a + "/" + b)
except:
pass
os.makedirs("pastes/" + a + "/" + b, exist_ok=True)

ppath = "pastes/" + a + "/" + b + "/" + paste_id

Expand Down Expand Up @@ -77,10 +70,7 @@ def update_paste_metadata(paste_id, metadata):
a = paste_id[0:2]
b = paste_id[2:4]

try:
os.makedirs("pastes/" + a + "/" + b)
except:
pass
os.makedirs("pastes/" + a + "/" + b, exist_ok=True)

ppath = "pastes/" + a + "/" + b + "/" + paste_id

Expand Down

0 comments on commit 60d6e12

Please sign in to comment.