From a9a6bd0583412af6524383524775f80252af490c 2013-10-23 02:45:38 From: MinRK Date: 2013-10-23 02:45:38 Subject: [PATCH] add unregister_target to CommManagers --- diff --git a/IPython/html/static/services/kernels/js/comm.js b/IPython/html/static/services/kernels/js/comm.js index 3351e42..91760ac 100644 --- a/IPython/html/static/services/kernels/js/comm.js +++ b/IPython/html/static/services/kernels/js/comm.js @@ -45,6 +45,11 @@ var IPython = (function (IPython) { this.targets[target_name] = f; }; + CommManager.prototype.unregister_target = function (target_name, f) { + // Unregister a target function for a given target name + delete this.targets[target_name]; + }; + CommManager.prototype.register_comm = function (comm) { // Register a comm in the mapping this.comms[comm.comm_id] = comm; diff --git a/IPython/kernel/comm/manager.py b/IPython/kernel/comm/manager.py index 315209f..14fbdd7 100644 --- a/IPython/kernel/comm/manager.py +++ b/IPython/kernel/comm/manager.py @@ -89,6 +89,10 @@ class CommManager(LoggingConfigurable): self.targets[target_name] = f + def unregister_target(self, target_name, f): + """Unregister a callable registered with register_target""" + return self.targets.pop(target_name); + def register_comm(self, comm): """Register a new comm""" comm_id = comm.comm_id