From 2189552e0277e923469a49d7c7d29e0bb57c61d1 Mon Sep 17 00:00:00 2001 From: Zsailer Date: Thu, 3 Sep 2020 15:58:51 -0700 Subject: [PATCH 1/2] make add_extensions return bool for success/fail --- jupyter_server/extension/manager.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/jupyter_server/extension/manager.py b/jupyter_server/extension/manager.py index 111e60d7af..99f102c2af 100644 --- a/jupyter_server/extension/manager.py +++ b/jupyter_server/extension/manager.py @@ -275,12 +275,17 @@ def from_jpserver_extensions(self, jpserver_extensions): self.add_extension(name, enabled=enabled) def add_extension(self, extension_name, enabled=False): + """Try to add extension to manager, return True is successful. + Otherwise, return False. + """ try: extpkg = ExtensionPackage(name=extension_name, enabled=enabled) self._extensions[extension_name] = extpkg + return True # Raise a warning if the extension cannot be loaded. except Exception as e: self.log.warning(e) + return False def link_extension(self, name, serverapp): linked = self._linked_extensions.get(name, False) From 0f105aec6911b513f31413a2d351cb15e8c23028 Mon Sep 17 00:00:00 2001 From: Zachary Sailer Date: Fri, 4 Sep 2020 08:04:51 -0700 Subject: [PATCH 2/2] Update jupyter_server/extension/manager.py --- jupyter_server/extension/manager.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/jupyter_server/extension/manager.py b/jupyter_server/extension/manager.py index 99f102c2af..aab4c594f4 100644 --- a/jupyter_server/extension/manager.py +++ b/jupyter_server/extension/manager.py @@ -275,7 +275,7 @@ def from_jpserver_extensions(self, jpserver_extensions): self.add_extension(name, enabled=enabled) def add_extension(self, extension_name, enabled=False): - """Try to add extension to manager, return True is successful. + """Try to add extension to manager, return True if successful. Otherwise, return False. """ try: @@ -325,4 +325,3 @@ def load_all_extensions(self, serverapp): # order. for name in sorted(self.extensions.keys()): self.load_extension(name, serverapp) -