Skip to content

Commit

Permalink
try creating db if doesn't exist (regression)
Browse files Browse the repository at this point in the history
  • Loading branch information
zielmicha committed Aug 24, 2013
1 parent 7f6c7c0 commit 13481a3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion graveldb.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

class TDBShelf(object):
def __init__(self, path):
mode = os.O_RDWR | os.O_CREAT if os.access(path, os.W_OK) else os.O_RDONLY
write = not os.path.exists(path) or os.access(path, os.W_OK)
mode = os.O_RDWR | os.O_CREAT if write else os.O_RDONLY
self.db = tdb.open(path, flags=mode)

def __getitem__(self, name):
Expand Down

0 comments on commit 13481a3

Please sign in to comment.