##// END OF EJS Templates
use notebook-dir as cwd for kernels
MinRK -
Show More
@@ -330,8 +330,9 b' class MainKernelHandler(AuthenticatedHandler):'
330 @web.authenticated
330 @web.authenticated
331 def post(self):
331 def post(self):
332 km = self.application.kernel_manager
332 km = self.application.kernel_manager
333 nbm = self.application.notebook_manager
333 notebook_id = self.get_argument('notebook', default=None)
334 notebook_id = self.get_argument('notebook', default=None)
334 kernel_id = km.start_kernel(notebook_id)
335 kernel_id = km.start_kernel(notebook_id, cwd=nbm.notebook_dir)
335 data = {'ws_url':self.ws_url,'kernel_id':kernel_id}
336 data = {'ws_url':self.ws_url,'kernel_id':kernel_id}
336 self.set_header('Location', '/'+kernel_id)
337 self.set_header('Location', '/'+kernel_id)
337 self.finish(jsonapi.dumps(data))
338 self.finish(jsonapi.dumps(data))
@@ -245,7 +245,7 b' class MappingKernelManager(MultiKernelManager):'
245 if notebook_id is not None:
245 if notebook_id is not None:
246 del self._notebook_mapping[notebook_id]
246 del self._notebook_mapping[notebook_id]
247
247
248 def start_kernel(self, notebook_id=None):
248 def start_kernel(self, notebook_id=None, **kwargs):
249 """Start a kernel for a notebok an return its kernel_id.
249 """Start a kernel for a notebok an return its kernel_id.
250
250
251 Parameters
251 Parameters
@@ -257,7 +257,6 b' class MappingKernelManager(MultiKernelManager):'
257 """
257 """
258 kernel_id = self.kernel_for_notebook(notebook_id)
258 kernel_id = self.kernel_for_notebook(notebook_id)
259 if kernel_id is None:
259 if kernel_id is None:
260 kwargs = dict()
261 kwargs['extra_arguments'] = self.kernel_argv
260 kwargs['extra_arguments'] = self.kernel_argv
262 kernel_id = super(MappingKernelManager, self).start_kernel(**kwargs)
261 kernel_id = super(MappingKernelManager, self).start_kernel(**kwargs)
263 self.set_kernel_for_notebook(notebook_id, kernel_id)
262 self.set_kernel_for_notebook(notebook_id, kernel_id)
@@ -407,7 +407,6 b' class NotebookApp(BaseIPythonApplication):'
407 def init_configurables(self):
407 def init_configurables(self):
408 # force Session default to be secure
408 # force Session default to be secure
409 default_secure(self.config)
409 default_secure(self.config)
410 # Create a KernelManager and start a kernel.
411 self.kernel_manager = MappingKernelManager(
410 self.kernel_manager = MappingKernelManager(
412 config=self.config, log=self.log, kernel_argv=self.kernel_argv,
411 config=self.config, log=self.log, kernel_argv=self.kernel_argv,
413 connection_dir = self.profile_dir.security_dir,
412 connection_dir = self.profile_dir.security_dir,
General Comments 0
You need to be logged in to leave comments. Login now