1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Removed default empty content argument from HttpResponse calls.

This commit is contained in:
Jon Dufresne 2019-02-09 13:27:32 -08:00 committed by Tim Graham
parent 959d0c078a
commit c492fdfd24
9 changed files with 15 additions and 15 deletions

View File

@ -118,7 +118,7 @@ And the view::
def head(self, *args, **kwargs): def head(self, *args, **kwargs):
last_book = self.get_queryset().latest('publication_date') last_book = self.get_queryset().latest('publication_date')
response = HttpResponse('') response = HttpResponse()
# RFC 1123 date format # RFC 1123 date format
response['Last-Modified'] = last_book.publication_date.strftime('%a, %d %b %Y %H:%M:%S GMT') response['Last-Modified'] = last_book.publication_date.strftime('%a, %d %b %Y %H:%M:%S GMT')
return response return response

View File

@ -20,7 +20,7 @@ def file_upload_view(request):
# not the full path. # not the full path.
if os.path.dirname(form_data['file_field'].name) != '': if os.path.dirname(form_data['file_field'].name) != '':
return HttpResponseServerError() return HttpResponseServerError()
return HttpResponse('') return HttpResponse()
else: else:
return HttpResponseServerError() return HttpResponseServerError()
@ -50,7 +50,7 @@ def file_upload_view_verify(request):
obj = FileModel() obj = FileModel()
obj.testfile.save(largefile.name, largefile) obj.testfile.save(largefile.name, largefile)
return HttpResponse('') return HttpResponse()
def file_upload_unicode_name(request): def file_upload_unicode_name(request):
@ -79,7 +79,7 @@ def file_upload_unicode_name(request):
if response: if response:
return response return response
else: else:
return HttpResponse('') return HttpResponse()
def file_upload_echo(request): def file_upload_echo(request):
@ -157,4 +157,4 @@ def file_upload_content_type_extra(request):
def file_upload_fd_closing(request, access): def file_upload_fd_closing(request, access):
if access == 't': if access == 't':
request.FILES # Trigger file parsing. request.FILES # Trigger file parsing.
return HttpResponse('') return HttpResponse()

View File

@ -2,4 +2,4 @@ from django.http import HttpResponse
def empty_view(request, *args, **kwargs): def empty_view(request, *args, **kwargs):
return HttpResponse('') return HttpResponse()

View File

@ -2,4 +2,4 @@ from django.http import HttpResponse
def empty_view(request, *args, **kwargs): def empty_view(request, *args, **kwargs):
return HttpResponse('') return HttpResponse()

View File

@ -22,7 +22,7 @@ def model_view(request):
def create_model_instance(request): def create_model_instance(request):
person = Person(name='emily') person = Person(name='emily')
person.save() person.save()
return HttpResponse('') return HttpResponse()
def environ_view(request): def environ_view(request):

View File

@ -21,7 +21,7 @@ def no_template_view(request):
def staff_only_view(request): def staff_only_view(request):
"A view that can only be visited by staff. Non staff members get an exception" "A view that can only be visited by staff. Non staff members get an exception"
if request.user.is_staff: if request.user.is_staff:
return HttpResponse('') return HttpResponse()
else: else:
raise CustomTestException() raise CustomTestException()

View File

@ -16,4 +16,4 @@ def no_template_used(request):
def empty_response(request): def empty_response(request):
return HttpResponse('') return HttpResponse()

View File

@ -2,4 +2,4 @@ from django.http import HttpResponse
def empty_view(request, *args, **kwargs): def empty_view(request, *args, **kwargs):
return HttpResponse('') return HttpResponse()

View File

@ -7,11 +7,11 @@ from django.views.generic import RedirectView
def empty_view(request, *args, **kwargs): def empty_view(request, *args, **kwargs):
return HttpResponse('') return HttpResponse()
def absolute_kwargs_view(request, arg1=1, arg2=2): def absolute_kwargs_view(request, arg1=1, arg2=2):
return HttpResponse('') return HttpResponse()
def defaults_view(request, arg1, arg2): def defaults_view(request, arg1, arg2):
@ -27,7 +27,7 @@ def erroneous_view(request):
def pass_resolver_match_view(request, *args, **kwargs): def pass_resolver_match_view(request, *args, **kwargs):
response = HttpResponse('') response = HttpResponse()
response.resolver_match = request.resolver_match response.resolver_match = request.resolver_match
return response return response
@ -37,7 +37,7 @@ uncallable = None # neither a callable nor a string
class ViewClass: class ViewClass:
def __call__(self, request, *args, **kwargs): def __call__(self, request, *args, **kwargs):
return HttpResponse('') return HttpResponse()
view_class_instance = ViewClass() view_class_instance = ViewClass()