

def execute_callback(self, args, callback, **params):
    'Executes the given callback function and returns a response.\n\n        Before executing the given callback, the\n        :attr:`sijax.Sijax.EVENT_BEFORE_PROCESSING` event callback is fired.\n        After executing the given callback, the\n        :attr:`sijax.Sijax.EVENT_AFTER_PROCESSING` event callback is fired.\n\n        The returned result could either be a string (for regular functions)\n        or a generator (for streaming functions like Comet or Upload).\n\n        :param args: the arguments list to pass to the callback\n        :param callback: the callback function to execute\n        :param options: more options - look at\n                                       :meth:`sijax.Sijax.register_callback`\n                                       to see what else is available\n        :return: string for regular callbacks or generator for streaming callbacks\n        '
    cls = self.__class__
    response_class = BaseResponse
    if (cls.PARAM_RESPONSE_CLASS in params):
        response_class = params[cls.PARAM_RESPONSE_CLASS]
    args_extra = []
    if (cls.PARAM_ARGS_EXTRA in params):
        args_extra = params[cls.PARAM_ARGS_EXTRA]
    if (not hasattr(callback, '__call__')):
        raise SijaxError('Provided callback is not callable!')
    obj_response = response_class(self, args)
    call_args = (args_extra + obj_response._get_request_args())
    call_chain = [(self._events[cls.EVENT_BEFORE_PROCESSING], []), (callback, call_args), (self._events[cls.EVENT_AFTER_PROCESSING], [])]
    return obj_response._process_call_chain(call_chain)

dataset/ETHPy150Open spantaleev/sijax-python/sijax/core.py Sijax.execute_callback/original