def cur_user(self): user_name_cookie = self.get_cookie('username','') user_code_cookie = self.get_cookie('usercode','') if user_name_cookie and user_code_cookie: from model import Member return Member.check_loged_user(user_name_cookie, user_code_cookie) else: return None
def authorized_handler(self, *args, **kw): request = self.request user_name_cookie = self.get_cookie('username','') user_code_cookie = self.get_cookie('usercode','') if user_name_cookie and user_code_cookie: from model import Member user = Member.check_loged_user(user_name_cookie, user_code_cookie, flag) else: user = False if request.method == 'GET': if not user: self.redirect(url) return False else: handler(self, *args, **kw) else: if not user: self.set_status(403) #self.error(403) else: handler(self, *args, **kw)