Set cookie to "empty" value at logout:
expires = datetime.datetime.utcnow()
self.response.set_cookie(key="uid", value="empty", expires=expires)
Check for "empty" in checkcookie:
def checkcookie(self, cookie_vrednost):
if cookie_vrednost == "empty":
return False
else:
user_id, code, expires_ts = cookie_vrednost.split(":")
if datetime.datetime.utcfromtimestamp(float(expires_ts)) > datetime.datetime.now():
check = hmac.new(str(user_id), str(secret) + str(expires_ts), hashlib.sha1).hexdigest()
if code == check:
return True
else:
return False
else:
return False