def admin_only(func):
def _admin_only(*args, **kwargs):
user = args[1].user
if user is None or not user.admin:
print user, "is forbidden"
raise exc.HTTPForbidden('You do not have sufficient permissions to view this page')
return func(args, **kwargs)
return _admin_only
评论列表
文章目录