0

I defined a fabric def using decorators like below:

@task(alias=dp)
def deploy:
    # the code

But I want to have access to the alias inside my def?

I can't use self. to get access :(

Kakawait
  • 3,929
  • 6
  • 33
  • 60

1 Answers1

0

I am not sure if you can do it in direct way, but if you will call task trough the 'task api' - kind of wrapper - you will have access to the parameters, at least inside the 'itnernaltask'.

from fabric.api import execute, task
@task
def internaltask():
    execute("deploy", alias=dp)
bluszcz
  • 4,054
  • 4
  • 33
  • 52
  • I accept your response "it's not possible". Finally I just unwrap def and use class without decorator. Thus I have the inheritance of the Task class and I can accept to *args & **kwargs that contains all I need. – Kakawait Feb 18 '13 at 14:47