1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Refs #23919 -- Removed obsolete contextlib.closing() calls (for Python 2).

This commit is contained in:
Tim Graham
2017-01-19 08:50:28 -05:00
committed by GitHub
parent 7d20094996
commit 5320fa77c3
3 changed files with 7 additions and 10 deletions

View File

@@ -1,4 +1,3 @@
import contextlib
import hashlib
import json
import os
@@ -98,7 +97,7 @@ def file_upload_echo_content(request):
Simple view to echo back the content of uploaded files for tests.
"""
def read_and_close(f):
with contextlib.closing(f):
with f:
return f.read().decode('utf-8')
r = {k: read_and_close(f) for k, f in request.FILES.items()}
return HttpResponse(json.dumps(r))