summaryrefslogtreecommitdiff
path: root/django/http/request.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/http/request.py')
-rw-r--r--django/http/request.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/django/http/request.py b/django/http/request.py
index 84457c5300..250db32bf2 100644
--- a/django/http/request.py
+++ b/django/http/request.py
@@ -5,6 +5,7 @@ import os
import re
import sys
from io import BytesIO
+from itertools import chain
from pprint import pformat
from django.conf import settings
@@ -256,6 +257,11 @@ class HttpRequest(object):
else:
self._post, self._files = QueryDict('', encoding=self._encoding), MultiValueDict()
+ def close(self):
+ if hasattr(self, '_files'):
+ for f in chain.from_iterable(l[1] for l in self._files.lists()):
+ f.close()
+
# File-like and iterator interface.
#
# Expects self._stream to be set to an appropriate source of bytes by