mirror of
https://github.com/Kozea/Radicale.git
synced 2025-08-01 18:18:31 +00:00
Cosmetics
This commit is contained in:
parent
1e5c9f63a0
commit
5e5b8b844f
1 changed files with 6 additions and 6 deletions
|
@ -392,8 +392,8 @@ class Collection(BaseCollection):
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def _atomic_write(self, path, mode="w"):
|
def _atomic_write(self, path, mode="w"):
|
||||||
dir = os.path.dirname(path)
|
tmp = NamedTemporaryFile(
|
||||||
tmp = NamedTemporaryFile(mode=mode, dir=dir, encoding=self.encoding,
|
mode=mode, dir=os.path.dirname(path), encoding=self.encoding,
|
||||||
delete=False, prefix=".Radicale.tmp-")
|
delete=False, prefix=".Radicale.tmp-")
|
||||||
try:
|
try:
|
||||||
yield tmp
|
yield tmp
|
||||||
|
@ -650,10 +650,10 @@ class Collection(BaseCollection):
|
||||||
try:
|
try:
|
||||||
os.rmdir(self._filesystem_path)
|
os.rmdir(self._filesystem_path)
|
||||||
except OSError:
|
except OSError:
|
||||||
with TemporaryDirectory(prefix=".Radicale.tmp-",
|
with TemporaryDirectory(
|
||||||
dir=parent_dir) as tmp_dir:
|
prefix=".Radicale.tmp-", dir=parent_dir) as tmp:
|
||||||
os.rename(self._filesystem_path, os.path.join(
|
os.rename(self._filesystem_path, os.path.join(
|
||||||
tmp_dir, os.path.basename(self._filesystem_path)))
|
tmp, os.path.basename(self._filesystem_path)))
|
||||||
self._sync_directory(parent_dir)
|
self._sync_directory(parent_dir)
|
||||||
else:
|
else:
|
||||||
self._sync_directory(parent_dir)
|
self._sync_directory(parent_dir)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue