def signalcommand(func):
 def inner(self, *args, **kwargs):
  pre_command.send(self.__class__, args=args, kwargs=kwargs)
  ret = func(self, *args, **kwargs)
  post_command.send(self.__class__, args=args, kwargs=kwargs, outcome=ret)
  return ret
 return inner

def signalcommand ( func ) : def inner ( self , * args , ** kwargs ) : pre_command . send ( self . __class__ , args = args , kwargs = kwargs ) ret = func ( self , * args , ** kwargs ) post_command . send ( self . __class__ , args = args , kwargs = kwargs , outcome = ret ) return ret return inner
a decorator for management command handle defs that sends out a pre/post signal .