##// END OF EJS Templates
Merge pull request #7083 from takluyver/server-extensions...
Jonathan Frederic -
r19489:23c94e27 merge
parent child Browse files
Show More
@@ -9,6 +9,7 b' from __future__ import print_function'
9 9 import base64
10 10 import datetime
11 11 import errno
12 import importlib
12 13 import io
13 14 import json
14 15 import logging
@@ -709,6 +710,11 b' class NotebookApp(BaseIPythonApplication):'
709 710 self.config.FileContentsManager.root_dir = new
710 711 self.config.MappingKernelManager.root_dir = new
711 712
713 server_extensions = List(Unicode(), config=True,
714 help=("Python modules to load as notebook server extensions. "
715 "This is an experimental API, and may change in future releases.")
716 )
717
712 718 def parse_command_line(self, argv=None):
713 719 super(NotebookApp, self).parse_command_line(argv)
714 720
@@ -916,6 +922,24 b' class NotebookApp(BaseIPythonApplication):'
916 922 self.log.warn("components submodule unclean, you may see 404s on static/components")
917 923 self.log.warn("run `setup.py submodule` or `git submodule update` to update")
918 924
925 def init_server_extensions(self):
926 """Load any extensions specified by config.
927
928 Import the module, then call the load_jupyter_server_extension function,
929 if one exists.
930
931 The extension API is experimental, and may change in future releases.
932 """
933 for modulename in self.server_extensions:
934 try:
935 mod = importlib.import_module(modulename)
936 func = getattr(mod, 'load_jupyter_server_extension', None)
937 if func is not None:
938 func(self)
939 except Exception:
940 self.log.warn("Error loading server extension %s", modulename,
941 exc_info=True)
942
919 943 @catch_config_error
920 944 def initialize(self, argv=None):
921 945 super(NotebookApp, self).initialize(argv)
@@ -926,6 +950,7 b' class NotebookApp(BaseIPythonApplication):'
926 950 self.init_webapp()
927 951 self.init_terminals()
928 952 self.init_signal()
953 self.init_server_extensions()
929 954
930 955 def cleanup_kernels(self):
931 956 """Shutdown all kernels.
General Comments 0
You need to be logged in to leave comments. Login now