Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _setHandler(self, endpoint, handler, coreFunction, doesReturn):
'''
Register or Subscribe. Invokes targetFunction for the given endpoint and handler.
:param coreFunction: the intended core function, either Subscribe or Register
:param doesReturn: True if this handler can return a value (is a registration)
'''
d, handlerId = Deferred(), utils.newID()
self.app.deferreds[d.cb], self.app.deferreds[d.eb] = d, d
self.app.handlers[handlerId] = handler, doesReturn
coreFunction(endpoint, d.cb, d.eb, handlerId, cumin.reflect(handler))
return d