Django

Code

Ticket #4933 (closed: fixed)

Opened 1 year ago

Last modified 1 year ago

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

Reported by: Ludvig Ericson <ludvig.ericson@gmail.com> Assigned to: adrian
Milestone: Component: Core framework
Version: SVN Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

xheaders.py.diff (1.7 kB) - added by Ludvig Ericson <ludvig.ericson@gmail.com> on 07/20/07 05:08:54.

Change History

07/20/07 05:08:54 changed by Ludvig Ericson <ludvig.ericson@gmail.com>

  • attachment xheaders.py.diff added.

07/22/07 00:58:29 changed by Simon G. <dev@simon.net.nz>

  • needs_better_patch changed.
  • stage changed from Unreviewed to Ready for checkin.
  • needs_tests changed.
  • needs_docs changed.

08/12/07 05:28:47 changed 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.

08/12/07 05:30:00 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

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

08/12/07 06:27:53 changed by Ludvig Ericson <ludvig.ericson@gmail.com>

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/Change #4933 (django/core/xheaders.py violates PEP8 and has a typo)




Change Properties
Action