summaryrefslogtreecommitdiff
path: root/django/core/files/temp.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/core/files/temp.py')
-rw-r--r--django/core/files/temp.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/django/core/files/temp.py b/django/core/files/temp.py
index 58fbd231dc..77563eed37 100644
--- a/django/core/files/temp.py
+++ b/django/core/files/temp.py
@@ -69,6 +69,13 @@ if os.name == 'nt':
def __del__(self):
self.close()
+ def __enter__(self):
+ self.file.__enter__()
+ return self
+
+ def __exit__(self, exc, value, tb):
+ self.file.__exit__(exc, value, tb)
+
NamedTemporaryFile = TemporaryFile
else:
NamedTemporaryFile = tempfile.NamedTemporaryFile