Allow opening binary files with _atomic_write
This commit is contained in:
parent
1dee561692
commit
0ffa97eca0
@ -423,8 +423,8 @@ class Collection(BaseCollection):
|
|||||||
def _atomic_write(self, path, mode="w", newline=None):
|
def _atomic_write(self, path, mode="w", newline=None):
|
||||||
directory = os.path.dirname(path)
|
directory = os.path.dirname(path)
|
||||||
tmp = NamedTemporaryFile(
|
tmp = NamedTemporaryFile(
|
||||||
mode=mode, dir=directory, encoding=self.encoding,
|
mode=mode, dir=directory, delete=False, prefix=".Radicale.tmp-",
|
||||||
delete=False, prefix=".Radicale.tmp-", newline=newline)
|
newline=newline, encoding=None if "b" in mode else self.encoding)
|
||||||
try:
|
try:
|
||||||
yield tmp
|
yield tmp
|
||||||
self._fsync(tmp.fileno())
|
self._fsync(tmp.fileno())
|
||||||
|
Loading…
Reference in New Issue
Block a user