Error on disabling extension not currently enabled

This commit is contained in:
Thomas Kluyver 2015-07-20 10:22:32 -07:00
parent 095e77dfd7
commit 00bb47fb24

View File

@ -371,6 +371,8 @@ class DisableNBExtensionApp(JupyterApp):
# Local import to avoid circular import issue on Py 2 # Local import to avoid circular import issue on Py 2
from notebook.services.config import ConfigManager from notebook.services.config import ConfigManager
cm = ConfigManager(parent=self, config=self.config) cm = ConfigManager(parent=self, config=self.config)
if name not in cm.get(self.section).get('load_extensions', {}):
sys.exit('{} is not enabled in section {}'.format(name, self.section))
# We're using a dict as a set - updating with None removes the key # We're using a dict as a set - updating with None removes the key
cm.update(self.section, {"load_extensions": {name: None}}) cm.update(self.section, {"load_extensions": {name: None}})