Skip to content

Commit

Permalink
Internal: Check if storage file exists before attempting to create it (
Browse files Browse the repository at this point in the history
  • Loading branch information
sserrata authored and msiemens committed Oct 12, 2018
1 parent bf714ac commit 51e2c69
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tinydb/storages.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ def touch(fname, create_dirs):
if not os.path.exists(base_dir):
os.makedirs(base_dir)

with open(fname, 'a'):
os.utime(fname, None)
if not os.path.exists(fname):
with open(fname, 'a'):
os.utime(fname, None)


class Storage(with_metaclass(ABCMeta, object)):
Expand Down

0 comments on commit 51e2c69

Please sign in to comment.