Opened 7 years ago

Closed 7 years ago

#6704 enhancement closed fixed (fixed)

Deprecate the `headers` and `received_headers` attributes of `IRequest` and implementations of that interface

Reported by: Jean-Paul Calderone Owned by: Jean-Paul Calderone
Priority: normal Milestone:
Component: web Keywords:
Cc: jknight Branch: branches/deprecate-old-headers-6704
branch-diff, diff-cov, branch-cov, buildbot
Author: exarkun

Description

These attributes were made into cumbersome aliases (for responseHeaders and requestHeaders respectively) some time ago. We should nudge everyone towards the new interface so we can actually get rid of the old one and its support code some day.

Change History (6)

comment:1 Changed 7 years ago by DefaultCC Plugin

Cc: jknight added

comment:2 Changed 7 years ago by Jean-Paul Calderone

Author: exarkun
Branch: branches/deprecate-old-headers-6704

(In [39752]) Branching to 'deprecate-old-headers-6704'

comment:3 Changed 7 years ago by Jean-Paul Calderone

Keywords: review added
Owner: Jean-Paul Calderone deleted

comment:4 Changed 7 years ago by Richard Wall

Owner: set to Richard Wall
Status: newassigned

comment:5 Changed 7 years ago by Richard Wall

Keywords: review removed
Owner: changed from Richard Wall to Jean-Paul Calderone
Status: assignednew

Thanks exarkun,

This all looks fine.

Notes:

  • Merges cleanly
  • t.web tests pass
  • Checked that there aren't any remaining uses of headers or request_headers outside of the tests.
  • Checked that the warnings are shown with PYTHONWARNINGS=default python
  • I wondered whether it might be better to use addRawHeader instead of setRawHeaders so as not to replace headers that might already have been present. But I see that the _DictHeaders thing works that way, so ok.
  • Re-ran the pyflakes builder and it went green
  • Re-ran the twistedchecker builder and it had fewer warnings.

Points:

  1. source:branches/deprecate-old-headers-6704/twisted/web/test/test_http.py
    1. sub needs documentation (https://buildbot.twistedmatrix.com/builders/twistedchecker/builds/1275/steps/run-twistedchecker/logs/new%20twistedchecker%20errors)

Please merge after adding that missing docstring.

comment:6 Changed 7 years ago by Jean-Paul Calderone

Resolution: fixed
Status: newclosed

(In [39951]) Merge deprecate-old-headers-6704

Author: exarkun Reviewer: rwall Fixes: #6704

The old-style header attributes of twisted.web.iweb.IRequest, received_headers and headers are now deprecated in favor of the more featureful requestHeaders and responseHeaders attributes.

Note: See TracTickets for help on using tickets.