我对Python仍然很陌生。给定一个具有装饰器的函数,函数是否可以访问它们的正文?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)
哇!我不知道'sys._getFrame(1)'。很高兴知道。为你+1。 – Chandranshu