示例#1
0
文件: BaseHandler.py 项目: arzh/CS253
	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)
示例#2
0
文件: BaseHandler.py 项目: arzh/CS253
	def get_cookie(self, name):
		cookie = self.request.cookies.get(name)
		return cookie and HashStr.check_sstr(cookie)