Ticket #3362: httpresponsenocontent.3.patch

File httpresponsenocontent.3.patch, 1.2 KB (added by afternoon@…, 18 years ago)

Add django.http.HttpResponseNoContent (status 204 response class) and documentation

  • django/http/__init__.py

     
    253253            raise Exception, "This %s instance cannot tell its position" % self.__class__
    254254        return sum([len(chunk) for chunk in self._container])
    255255
     256class HttpResponseNoContent(HttpResponse):
     257    def __init__(self):
     258        HttpResponse.__init__(self)
     259        self.status_code = 204
     260
    256261class HttpResponseRedirect(HttpResponse):
    257262    def __init__(self, redirect_to):
    258263        HttpResponse.__init__(self)
  • docs/request_response.txt

     
    417417    The constructor doesn't take any arguments. Use this to designate that a
    418418    page hasn't been modified since the user's last request.
    419419
     420``HttpResponseNoContent``
     421    Indicate that request has been processed successfully but that no response
     422    content is required. The constructor doesn't take any arguments.
     423
    420424``HttpResponseNotFound``
    421425    Acts just like ``HttpResponse`` but uses a 404 status code.
    422426
Back to Top