Skip to content

Commit 3f5cafa

Browse files
committed
Prevent broken json encoding to clear original file
1 parent 4952818 commit 3f5cafa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

jsondb/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ def save(self, o):
135135
o['_rev'] = 0
136136

137137
os.makedirs(os.path.dirname(path), exist_ok=True)
138+
s = json.dumps(o, indent=2)
138139
with open(path, 'wb') as f:
139-
s = json.dumps(o, indent=2)
140140
f.write(s.encode('utf8'))
141141

142142
self._review(o, delete=True, add=True)

0 commit comments

Comments
 (0)