(func)
return inner
Python decorator for management command handle defs that sends out a pre/post signal.
Python decorator for management command handle defs that sends out a pre/post signal.
Python decorator for management command handle defs that sends out a pre / post signal .
def signalcommand(func):
    """Python decorator for management command handle defs that sends out a pre/post signal."""

    @wraps(func)
    def inner(self, *args, **kwargs):
        pre_command.send(self.__class__, args=args, kwargs=kwargs)
        try:
            ret = func(self, *args, **kwargs)
        except BaseException as e:
            post_command.send(self.__class__, args=args, kwargs=kwargs, outcome=e)
            raise

        post_command.send(self.__class__, args=args, kwargs=kwargs, outcome=ret)
        return ret
    return inner
def signalcommand ( func ) : @ wraps ( func ) def inner ( self , * args , * * kwargs ) : pre_command . send ( self . __class__ , args = args , kwargs = kwargs ) try : ret = func ( self , * args , * * kwargs ) except BaseException as e : post_command . send ( self . __class__ , args = args , kwargs = kwargs , outcome = e ) raise post_command . send ( self . __class__ , args = args , kwargs = kwargs , outcome = ret ) return ret return inner