Fix _atomic_write
This commit is contained in:
parent
5e5b8b844f
commit
5c2075cb6c
@ -392,8 +392,9 @@ class Collection(BaseCollection):
|
||||
|
||||
@contextmanager
|
||||
def _atomic_write(self, path, mode="w"):
|
||||
directory = os.path.dirname(path)
|
||||
tmp = NamedTemporaryFile(
|
||||
mode=mode, dir=os.path.dirname(path), encoding=self.encoding,
|
||||
mode=mode, dir=directory, encoding=self.encoding,
|
||||
delete=False, prefix=".Radicale.tmp-")
|
||||
try:
|
||||
yield tmp
|
||||
@ -408,7 +409,7 @@ class Collection(BaseCollection):
|
||||
tmp.close()
|
||||
os.remove(tmp.name)
|
||||
raise
|
||||
self._sync_directory(dir)
|
||||
self._sync_directory(directory)
|
||||
|
||||
def _find_available_file_name(self):
|
||||
# Prevent infinite loop
|
||||
|
Loading…
x
Reference in New Issue
Block a user