Code

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#4933 closed (fixed)

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

Reported by: Ludvig Ericson <ludvig.ericson@…> Owned by: adrian
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@…> 7 years ago.

Download all attachments as: .zip

Change History (5)

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

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

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Ready for checkin

comment:2 Changed 7 years ago by mtredinnick

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 7 years ago by mtredinnick

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

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

comment:4 Changed 7 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.

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.