Skip to content

Instantly share code, notes, and snippets.

@Nagyman
Nagyman / strict_roles.py
Created June 22, 2012 18:08
Decorator to strictly enforce the roles defined for a fabric task
from fabric.api import env
from fabric import tasks
from functools import wraps
def _wrap_as_new(original, new):
if isinstance(original, tasks.Task):
return tasks.WrappedCallableTask(new)
return new
def strict_roles(*role_list):