From e223412e7956731a915cb97c03c15532a7c42be7 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Mon, 23 Jul 2012 19:59:17 -0400 Subject: [PATCH] Ignore cookies set by other TS services. --- pages/settings.mako | 4 ++-- toolserver/cookies.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pages/settings.mako b/pages/settings.mako index b946736..bdd7825 100644 --- a/pages/settings.mako +++ b/pages/settings.mako @@ -23,7 +23,7 @@ . diff --git a/toolserver/cookies.py b/toolserver/cookies.py index 1cd93db..68b8b82 100644 --- a/toolserver/cookies.py +++ b/toolserver/cookies.py @@ -12,13 +12,16 @@ class _CookieManager(SimpleCookie): super(_CookieManager, self).__init__(environ["HTTP_COOKIE"]) except (CookieError, AttributeError): super(_CookieManager, self).__init__() + for cookie in self: + if self[cookie].value is False: + del self[cookie] def value_decode(self, value): unquoted = super(_CookieManager, self).value_decode(value)[0] try: return base64.b64decode(unquoted).decode("utf8"), value except (TypeError, UnicodeDecodeError): - return u"False", "False" + return False, "False" def value_encode(self, value): encoded = base64.b64encode(value.encode("utf8"))