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:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user