Skip to content

Commit

Permalink
Merge http-headers-update-keywords-6082: Fix updating twisted.web.htt…
Browse files Browse the repository at this point in the history
…p_headers._DictHeaders using keywords in Python 3.

Author: Unit03
Reviewer: adiroiban
Fixes: #6082

git-svn-id: svn://svn.twistedmatrix.com/svn/Twisted/trunk@46255 bbbe8e31-12d6-0310-92fd-ac37d47ddeeb
  • Loading branch information
adiroiban committed Nov 19, 2015
1 parent 192d621 commit 4b98d0b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 3 additions & 1 deletion twisted/web/http_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from collections import MutableMapping

from twisted.python.compat import comparable, cmp
from twisted.python.compat import comparable, cmp, StringType


def _dashCapitalize(name):
Expand Down Expand Up @@ -54,6 +54,8 @@ def __setitem__(self, key, value):
"""
Set the given header.
"""
if isinstance(key, StringType):
key = key.encode('ascii')
self._headers.setRawHeaders(key, [value])


Expand Down
3 changes: 0 additions & 3 deletions twisted/web/test/test_http_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,6 @@ def test_updateWithKeywords(self):
self.assertEqual(headers.getRawHeaders(b"foo"), [b"panda"])
self.assertEqual(headers.getRawHeaders(b"bar"), [b"marmot"])

if _PY3:
test_updateWithKeywords.skip = "Not yet supported on Python 3; see #6082."


def test_setdefaultMissing(self):
"""
Expand Down
1 change: 1 addition & 0 deletions twisted/web/topfiles/6082.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
twisted.web.http_headers._DictHeaders now correctly handles updating via keyword arguments in Python 3 (therefore twisted.web.http_headers is now fully ported to Python 3).

0 comments on commit 4b98d0b

Please sign in to comment.