Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#4933 closed (fixed)

django/core/xheaders.py violates PEP8 and has a typo

Reported by: Ludvig Ericson <ludvig.ericson@…> Owned by: Adrian Holovaty
Component: Core (Other) Version: master
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Call it nitpicking, but I noticed that there was a 160-byte wide line in django/core/xheaders.py and thought I'd break it up a bit and ended up rewriting 50% of the file.

Anyway, it's not very important or anything, just wanted to have the file adhere to PEP8. Feel free to ignore this (but perhaps at least fix the typo).

Did a manual regression test and I couldn't catch anything.

Attachments (1)

xheaders.py.diff (1.7 KB) - added by Ludvig Ericson <ludvig.ericson@…> 9 years ago.

Download all attachments as: .zip

Change History (5)

Changed 9 years ago by Ludvig Ericson <ludvig.ericson@…>

Attachment: xheaders.py.diff added

comment:1 Changed 9 years ago by Simon G. <dev@…>

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedReady for checkin

comment:2 Changed 9 years ago by Malcolm Tredinnick

We can certainly fix the typo (good catch).

I've reformatted the if test a bit as well to break it over lines. However, the rest of the rewrite, although well-intentioned, slows down the code a bit: every time you construct a try-except block, Django has to save the current stack frame and then free it later For something that is executed for every single response, we should be a little wary of adding overhead like that. The existing code gets there without the extra work, so I prefer that.

comment:3 Changed 9 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

(In [5870]) Fixed #4933 -- Fixed a typo and reformatted a fairly long line in passing. Thanks, Ludvig Ericson.

comment:4 Changed 9 years ago by Ludvig Ericson <ludvig.ericson@…>

Good point, (and when you say Django needs to save the stack frame, I assume you mean Python? :-) I didn't know that actually.

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