Code

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#15887 closed Cleanup/optimization (fixed)

Improve django.views.decorators.http docs

Reported by: RoySmith Owned by: nobody
Component: Documentation Version: 1.3
Severity: Normal Keywords:
Cc: cg@…, mathieu.agopian@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: yes UI/UX:

Description

require_http_methods()
require_GET()
require_POST()

None of these describe what happens if you try to access the view with the wrong method. Throw some exception? Return a 404? Cause daemons to fly out of your nose? Some additional clarity here would be useful.

Attachments (3)

fix_15887.diff (607 bytes) - added by EnTeQuAk 3 years ago.
fix_15887.2.diff (608 bytes) - added by Mathieu Agopian <mathieu.agopian@…> 3 years ago.
fixed typo
fix_15887.3.diff (587 bytes) - added by dmclain 3 years ago.

Download all attachments as: .zip

Change History (13)

comment:1 Changed 3 years ago by EnTeQuAk

  • Cc cg@… added
  • Component changed from Core (Other) to Documentation
  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Type changed from Bug to Cleanup/optimization

They return a proper 405 (Not Allowed) response. If it's really required to note this I created a small patch to mention the return value.

Changed 3 years ago by EnTeQuAk

comment:2 Changed 3 years ago by anonymous

If you are intimately familiar with HTTP, that might be obvious. I wasn't even aware the 405 code existed, so it took me a bit of experimenting to discover what it did, then some research to look up what the 405 code meant. Once I found the "Method Not Allowed" explanation, it was obvious in hind sight, but having the docs say that would have saved me a bunch of time. So, yes, I think it's "really required".

comment:3 Changed 3 years ago by Mathieu Agopian <mathieu.agopian@…>

  • Easy pickings set
  • Triage Stage changed from Unreviewed to Accepted

I've changed this ticket as accepted, as there's an explanation and even a doc path. Please let me know if this was to much of a bold move from me.

I've also set the "easy pickings" bit as i believe it's a pretty straightforward issue and fix.

comment:4 Changed 3 years ago by RoySmith

Thanks. But, change "This decorators will return" to "These decorators will return" :-)

Changed 3 years ago by Mathieu Agopian <mathieu.agopian@…>

fixed typo

comment:5 follow-up: Changed 3 years ago by Mathieu Agopian <mathieu.agopian@…>

  • Patch needs improvement set

I've attached a the documentation patch with the typo fixed. Could some please check this and remove the "patch needs improvement" if the fixed patch is ok?

comment:6 Changed 3 years ago by magopian

  • Cc mathieu.agopian@… added

Changed 3 years ago by dmclain

comment:7 Changed 3 years ago by aaugustin

  • Triage Stage changed from Accepted to Ready for checkin

comment:8 in reply to: ↑ 5 Changed 3 years ago by cg@…

Replying to Mathieu Agopian <mathieu.agopian@…>:

I've attached a the documentation patch with the typo fixed. Could some please check this and remove the "patch needs improvement" if the fixed patch is ok?

Thanks for fixing the typo ;)

comment:9 Changed 3 years ago by timo

  • Resolution set to fixed
  • Status changed from new to closed

In [16139]:

(The changeset message doesn't reference this ticket)

comment:10 Changed 3 years ago by timo

In [16140]:

[1.3.X] Fixed #15887 - Added clarification for required_*() decorators; thanks RoySmith for the sugggestion.

Backport of r16139 from trunk.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.