1. 裝飾器
AOP - 面向切面編程
def is_login(func):
def check_user():
sessin_id = request.COOKIES.get('session_id')
if not session_id:
return HttpResponseRedorect()
return func()
return check_user
AOP - 面向切面編程
def is_login(func):
def check_user():
sessin_id = request.COOKIES.get('session_id')
if not session_id:
return HttpResponseRedorect()
return func()
return check_user