From: Ben Darnell Date: Sat, 26 May 2012 17:54:34 +0000 (-0700) Subject: Override dict.copy in HTTPHeaders to return the correct type. X-Git-Tag: v2.3.0~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f41306da0fc7cc07b45e685bb28f57448df3c332;p=thirdparty%2Ftornado.git Override dict.copy in HTTPHeaders to return the correct type. Closes #519. --- diff --git a/tornado/httputil.py b/tornado/httputil.py index 7d884e28b..2cbf677bf 100644 --- a/tornado/httputil.py +++ b/tornado/httputil.py @@ -154,6 +154,10 @@ class HTTPHeaders(dict): for k, v in dict(*args, **kwargs).iteritems(): self[k] = v + def copy(self): + # default implementation returns dict(self), not the subclass + return HTTPHeaders(self) + _NORMALIZED_HEADER_RE = re.compile(r'^[A-Z0-9][a-z0-9]*(-[A-Z0-9][a-z0-9]*)*$') _normalized_headers = {}