码迷,mamicode.com
首页 > 其他好文 > 详细

测试代码高亮

时间:2017-09-27 00:52:09      阅读:221      评论:0      收藏:0      [点我收藏+]

标签:bbs   com   dap   ati   black   rgs   back   inpu   word   

# Author: Imxcai

 

 

username, password = ‘xcai‘, "xcai1234"

 

 

def auth(auth_type):

def out_wrapper(func):

def wrapper(*args, **kwargs):

if auth_type == ‘local‘:

user = input("username:").strip()

passwd = input("password:").strip()

if user == username and password == passwd:

print("authentication success")

return func(*args, **kwargs)

else:

print("authentication fail")

elif auth_type == ‘ldap‘:

print("i am not use ldap")

 

return wrapper

 

return out_wrapper

 

 

def index():

print("welcome to index page")

 

 

@auth(auth_type=‘local‘)

def home(name):

print("welcome to home page", name)

 

 

@auth(auth_type=‘ldap‘)

def bbs():

print("welcome to bbs page")

 

 

index()

home(‘abc‘)

bbs()

测试代码高亮

标签:bbs   com   dap   ati   black   rgs   back   inpu   word   

原文地址:http://www.cnblogs.com/imxcai/p/7599603.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!