소스 검색

Fix handling of disabled

Steven Silvester 8 년 전
부모
커밋
6c8350e760
2개의 변경된 파일4개의 추가작업 그리고 3개의 파일을 삭제
  1. 4 2
      jupyterlab/commands.py
  2. 0 1
      jupyterlab/tests/test_jupyterlab.py

+ 4 - 2
jupyterlab/commands.py

@@ -249,12 +249,14 @@ def _toggle_extension(extension, value, app_dir=None):
     if extension not in extensions and extension not in core_extensions:
         raise ValueError('Extension %s is not installed' % extension)
     disabled = config.get('disabledExtensions', [])
-    if extension in disabled:
+    if value and extension not in disabled:
+        disabled.append(extension)
+    if not value and extension in disabled:
         disabled.remove(extension)
 
     # Prune extensions that are not installed.
     disabled = [ext for ext in disabled
-                if (ext not in extensions and ext not in core_extensions)]
+                if (ext in extensions or ext in core_extensions)]
     config['disabledExtensions'] = disabled
     _write_page_config(config, app_dir)
 

+ 0 - 1
jupyterlab/tests/test_jupyterlab.py

@@ -105,7 +105,6 @@ class TestExtension(TestCase):
         self.assertEqual(commands.get_app_dir(), os.path.realpath(pjoin(self.data_dir, 'lab')))
 
         self.app_dir = commands.get_app_dir()
-        print('****', self.app_dir)
 
     def tearDown(self):
         for modulename in self._mock_extensions: