@@ -23,7 +23,7 @@ | |||||
</select> | </select> | ||||
<tt>.</tt> | <tt>.</tt> | ||||
<select name="project"> | <select name="project"> | ||||
<% 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: | % for code, name in projects: | ||||
% if code == selected_project: | % if code == selected_project: | ||||
<option value="${code}" selected="selected">${name}</option> | <option value="${code}" selected="selected">${name}</option> | ||||
@@ -48,7 +48,7 @@ | |||||
<ul> | <ul> | ||||
% for cookie in cookies.itervalues(): | % for cookie in cookies.itervalues(): | ||||
<li> | <li> | ||||
<tt>${cookie.key | h}</tt>: <tt>${cookie.value | h}</tt> (<tt>${cookie["path"] | h}</tt>) | |||||
<tt>${cookie.key | h}</tt>: <tt>${cookie.value | h}</tt> | |||||
<form action="${environ['PATH_INFO']}" method="post"> | <form action="${environ['PATH_INFO']}" method="post"> | ||||
<input type="hidden" name="action" value="delete"> | <input type="hidden" name="action" value="delete"> | ||||
<input type="hidden" name="cookie" value="${cookie.key | h}"> | <input type="hidden" name="cookie" value="${cookie.key | h}"> | ||||
@@ -12,13 +12,16 @@ class _CookieManager(SimpleCookie): | |||||
super(_CookieManager, self).__init__(environ["HTTP_COOKIE"]) | super(_CookieManager, self).__init__(environ["HTTP_COOKIE"]) | ||||
except (CookieError, AttributeError): | except (CookieError, AttributeError): | ||||
super(_CookieManager, self).__init__() | super(_CookieManager, self).__init__() | ||||
for cookie in self: | |||||
if self[cookie].value is False: | |||||
del self[cookie] | |||||
def value_decode(self, value): | def value_decode(self, value): | ||||
unquoted = super(_CookieManager, self).value_decode(value)[0] | unquoted = super(_CookieManager, self).value_decode(value)[0] | ||||
try: | try: | ||||
return base64.b64decode(unquoted).decode("utf8"), value | return base64.b64decode(unquoted).decode("utf8"), value | ||||
except (TypeError, UnicodeDecodeError): | except (TypeError, UnicodeDecodeError): | ||||
return u"False", "False" | |||||
return False, "False" | |||||
def value_encode(self, value): | def value_encode(self, value): | ||||
encoded = base64.b64encode(value.encode("utf8")) | encoded = base64.b64encode(value.encode("utf8")) | ||||