def set_cookie(self, name, data, save = False): dhash = HashStr.make_sstr(data) cookie = "%s=%s; Path=/;" % (name, dhash) if save: cookie = cookie+" Expires= Tue, 1 Jan 2025 00:00:00 GMT;" self.response.headers.add_header('Set-Cookie', cookie)
def get_cookie(self, name): cookie = self.request.cookies.get(name) return cookie and HashStr.check_sstr(cookie)