Fixed #20427 -- Moved a variable initialization in storage.py

This is fixing commit 4e70ad11d2. Thanks mattias at elements.nl
for the report and Baptiste Mispelon for identifying the faulty
commit.
This commit is contained in:
Claude Paroz 2013-05-17 18:29:41 +02:00
parent 0509462373
commit 838f28974e
1 changed files with 1 additions and 1 deletions

View File

@ -200,9 +200,9 @@ class FileSystemStorage(Storage):
getattr(os, 'O_BINARY', 0)) getattr(os, 'O_BINARY', 0))
# The current umask value is masked out by os.open! # The current umask value is masked out by os.open!
fd = os.open(full_path, flags, 0o666) fd = os.open(full_path, flags, 0o666)
_file = None
try: try:
locks.lock(fd, locks.LOCK_EX) locks.lock(fd, locks.LOCK_EX)
_file = None
for chunk in content.chunks(): for chunk in content.chunks():
if _file is None: if _file is None:
mode = 'wb' if isinstance(chunk, bytes) else 'wt' mode = 'wb' if isinstance(chunk, bytes) else 'wt'