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 @@ . - <% selected_project = cookies["EarwigDefaultProject"].value if "EarwigDefaultProject" in cookies else bot.wiki.get_site().lang %> + <% selected_project = cookies["EarwigDefaultProject"].value if "EarwigDefaultProject" in cookies else bot.wiki.get_site().project %> % for code, name in projects: % if code == selected_project: ${name} @@ -48,7 +48,7 @@ % for cookie in cookies.itervalues(): - ${cookie.key | h}: ${cookie.value | h} (${cookie["path"] | h}) + ${cookie.key | h}: ${cookie.value | h} 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"))