>
> Did you intend to have response subclasses for all 57 values of
> http.HTTPStatus?


I hadn't entirely thought it through before implementing :) I agree it's
too much, and many are highly unlikely for Django applications to respond
with, e.g. 203 Non-Authoritative Information.

I'll document the http.HTTPStatus solution and add only classes that
provide extra functionality for Django-app-plausible status codes.

On 7 August 2017 at 16:42, Tim Graham <[email protected]> wrote:

> I think I prefer documenting Berker's suggestion rather than adding more
> classes to Django, unless perhaps, they add some additional functionality
> as HttpResponseNoContent does.
>
> Did you intend to have response subclasses for all 57 values of
> http.HTTPStatus?
>
> On Sunday, August 6, 2017 at 4:17:22 PM UTC-4, Adam Johnson wrote:
>>
>> I've made a ticket for this: https://code.djangoproject.com/ticket/28469
>>
>> On 7 April 2017 at 11:18, Berker Peksağ <[email protected]> wrote:
>>
>>> On Fri, Apr 7, 2017 at 9:54 AM, Adam Johnson <[email protected]> wrote:
>>> > Personally I'd be in favour of adding such classes. It seems against
>>> the
>>> > batteries-included philosophy that Django does not provide all of the
>>> > standard codes as classes. I can never remember which codes correspond
>>> to
>>> > which response types, if I saw status=204 in code it would be a 'magic
>>> > number' for me and I'd have to look it up. HttpResponseRedirect and
>>> > HttpResponsePermanentRedirect have been my friends in the past, I can
>>> > imagine the same for HttpResponseNoContent.
>>>
>>> Alternatively, they can use the HTTPStatus enum from the stdlib if
>>> they are on Python 3.5+:
>>>
>>>     from http import HTTPStatus
>>>
>>>     HttpResponse(status=HTTPStatus.NO_CONTENT)
>>>
>>> --Berker
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django developers  (Contributions to Django itself)" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at https://groups.google.com/group/django-developers.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/django-developers/CAF4280K-fT8bRnc6fvpZj0RjuhK8b2-eSozMK
>>> EJMsPT0EinevQ%40mail.gmail.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Adam
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/django-developers.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-developers/54f2537f-5c5a-4d3c-99b1-
> 90630bc5b34f%40googlegroups.com
> <https://groups.google.com/d/msgid/django-developers/54f2537f-5c5a-4d3c-99b1-90630bc5b34f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Adam

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMyDDM1Tf8z8BPQnk1Rw9FBuhGNgXmi2RDodH%2BiSdodqYTpJdQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to