From: Ben Darnell Date: Sun, 28 Aug 2011 06:02:57 +0000 (-0700) Subject: Reinstate RequestHandler.cookies property X-Git-Tag: v2.1.0~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a85ec908b1f5d4c978e60728714edefa0202507;p=thirdparty%2Ftornado.git Reinstate RequestHandler.cookies property --- diff --git a/tornado/test/web_test.py b/tornado/test/web_test.py index 465f5feaa..e6aaa59b6 100644 --- a/tornado/test/web_test.py +++ b/tornado/test/web_test.py @@ -238,6 +238,8 @@ class TypeCheckHandler(RequestHandler): # get_argument is an exception from the general rule of using # type str for non-body data mainly for historical reasons. self.check_type('argument', self.get_argument('foo'), unicode) + self.check_type('cookie_key', self.cookies.keys()[0], str) + self.check_type('cookie_value', self.cookies.values()[0].value, str) self.check_type('xsrf_token', self.xsrf_token, bytes_type) self.check_type('xsrf_form_html', self.xsrf_form_html(), str) diff --git a/tornado/web.py b/tornado/web.py index 91c76adeb..cab456475 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -316,6 +316,10 @@ class RequestHandler(object): """ return _unicode(value) + @property + def cookies(self): + return self.request.cookies + def get_cookie(self, name, default=None): """Gets the value of the cookie with the given name, else default.""" if name in self.request.cookies: