From: Jacob Sondergaard Date: Thu, 5 Jan 2012 11:17:01 +0000 (+0100) Subject: Set the request cookies property to an empty dict if cookie parsing fails X-Git-Tag: v2.2.0~24^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F428%2Fhead;p=thirdparty%2Ftornado.git Set the request cookies property to an empty dict if cookie parsing fails This commit reverses the bug introduced in commit 4a4d871, leaving an undefined cookies property on failure to parse a request cookie. The bug results in a 'NoneType is not iterable' error when calling RequestHandler.get_cookie() after a cookie parsing exception. --- diff --git a/tornado/httpserver.py b/tornado/httpserver.py index e692ba8a9..3e985ba6c 100644 --- a/tornado/httpserver.py +++ b/tornado/httpserver.py @@ -407,7 +407,7 @@ class HTTPRequest(object): self._cookies.load( native_str(self.headers["Cookie"])) except Exception: - self._cookies = None + self._cookies = {} return self._cookies def write(self, chunk, callback=None):