【发布时间】:2013-12-04 22:08:45
【问题描述】:
我对 Python 还是很陌生。给定一个具有装饰器的函数,该函数是否可以访问它们的主体?
(来自Fabric 脚本)
@task
@roles('qa-env')
def deploy_qa():
#-----------------------------------------------------------------------
# Is there a way to get access to the @roles decorator as an array here?
#-----------------------------------------------------------------------
deployer.configureEnv('qa-env')
deployer.installApp1()
deployer.installApp2(True)
【问题讨论】:
标签: python decorator python-decorators