Opened 11 years ago

Closed 7 years ago

#10504 closed Cleanup/optimization (fixed)

Consistency between HttpResponse* params and render_to_response

Reported by: Brent Hagany Owned by: nobody
Component: HTTP handling Version: 1.0
Severity: Normal Keywords:
Cc: brent.hagany@…, Riccardo Attilio Galli Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: yes UI/UX: no


I was just browsing through some of the Django code and came across the new-ish (to me) addition of the content_type alias for the mimetype parameter to HttpResponse and company. Wondering about the rationale behind this decision, I came across ticket #3526, which may be helpful to review in evaluating this ticket.

In light of this, (and just for consistency) I thought it would probably be a good idea to allow render_to_response to pass content_type along to HttpResponse. I'll attach a simple patch that does this.

Also, this patch will conflict with another patch (#9081) I've submitted that has been accepted but not yet committed. It'll be very easy to resolve, but I'm unsure if I should take any special measures about this.

Attachments (2)

content_type_in_render_to_response.diff (1.2 KB) - added by Brent Hagany 11 years ago.
tkt-10504.diff (3.6 KB) - added by kenth 9 years ago.

Download all attachments as: .zip

Change History (19)

Changed 11 years ago by Brent Hagany

comment:1 Changed 11 years ago by Brent Hagany

Cc: brent.hagany@… added
Has patch: set

comment:2 Changed 11 years ago by Brent Hagany

Component: UncategorizedHTTP handling

comment:3 Changed 11 years ago by Jacob

Triage Stage: UnreviewedAccepted

comment:4 Changed 11 years ago by Roland van Laar

Needs tests: set

Needs tests.

comment:5 Changed 11 years ago by Brent Hagany

My initial reaction - really?

1) Nobody has found it necessary to write a single test for a shortcut before (unless I just don't understand where they would be)
2) This is less than a one line change
3) This ticket has been touched by a core committer and accepted, despite the absence of tests.

So, I mean, I can do this. But because of these things, I had been working under the assumption that it was not necessary. Please advise.

comment:6 Changed 11 years ago by ccahoon

Needs tests: unset

@bhagany As I understand it, "Accepted" means that he thinks the general idea of the ticket is valid, not that the patch is accepted. If the patch was accepted, jacob would have committed the changes. I think it's a fine patch, though. I found this ticket looking to see if someone had already done the work I was about to on my GSoC branch, and there yours is. I am going to apply your changes to my SoC branch, so it will be bound to get reviewed within a month or so.

comment:7 Changed 11 years ago by ccahoon

@bhagany Actually, I will probably spend some time hopping between the two patches you've submitted and get advice from my mentor. They both look good, but the other is indeed very flexible, and I don't see any problems with it yet.

comment:8 Changed 11 years ago by Brent Hagany

@ccahoon Sounds great! I've been following the work in your branch, and I'm happy to have saved you a teensy bit of work.

Also, re: accepted status - noted, and thanks for explaining.

comment:9 Changed 11 years ago by Chris Beaven

ccahoon: have you fixed this in your branch? (if so, update the triage stage)

comment:10 Changed 9 years ago by Chris Beaven

Severity: Normal
Type: Cleanup/optimization

comment:11 Changed 9 years ago by Julien Phalip

Needs tests: set

comment:12 Changed 9 years ago by Dougal Matthews

Easy pickings: set
UI/UX: unset

Changed 9 years ago by kenth

Attachment: tkt-10504.diff added

comment:13 Changed 9 years ago by kenth

Needs tests: unset

Added tests for new shortcut.

comment:14 Changed 8 years ago by anonymous

Resolution: invalid
Status: newclosed

In [da200c5e35cd] (in response to ticket #16519 ) mimetype has been deprecated, so the patch isn't anymore needed.

comment:15 Changed 8 years ago by Riccardo Attilio Galli

Cc: Riccardo Attilio Galli added

I sat the resolution to invalid erroneously as anonymous, ccing now to follow evenctual future messages

Last edited 8 years ago by Riccardo Attilio Galli (previous) (diff)

comment:16 Changed 8 years ago by Claude Paroz

Patch needs improvement: set
Resolution: invalid
Status: closedreopened

In [da200c5e35cd], we didn't address the render_to_response inconsistency, so I think that the attached patch still makes sense. We should however introduce a deprecation path for the mimetype argument also.

comment:17 Changed 7 years ago by Tim Graham

Resolution: fixed
Status: reopenedclosed

Deprecating of mimetype in render_to_response completed in #19692 and 89cb771be7b53c40642872cdbedb15943bdf8e34.

Note: See TracTickets for help on using tickets.
Back to Top