use notebook-dir as cwd for kernels

This commit is contained in:
MinRK 2012-06-13 14:31:24 -07:00
parent 26a1cc7ee2
commit 272b954d7b
3 changed files with 3 additions and 4 deletions

View File

@ -330,8 +330,9 @@ class MainKernelHandler(AuthenticatedHandler):
@web.authenticated
def post(self):
km = self.application.kernel_manager
nbm = self.application.notebook_manager
notebook_id = self.get_argument('notebook', default=None)
kernel_id = km.start_kernel(notebook_id)
kernel_id = km.start_kernel(notebook_id, cwd=nbm.notebook_dir)
data = {'ws_url':self.ws_url,'kernel_id':kernel_id}
self.set_header('Location', '/'+kernel_id)
self.finish(jsonapi.dumps(data))

View File

@ -245,7 +245,7 @@ class MappingKernelManager(MultiKernelManager):
if notebook_id is not None:
del self._notebook_mapping[notebook_id]
def start_kernel(self, notebook_id=None):
def start_kernel(self, notebook_id=None, **kwargs):
"""Start a kernel for a notebok an return its kernel_id.
Parameters
@ -257,7 +257,6 @@ class MappingKernelManager(MultiKernelManager):
"""
kernel_id = self.kernel_for_notebook(notebook_id)
if kernel_id is None:
kwargs = dict()
kwargs['extra_arguments'] = self.kernel_argv
kernel_id = super(MappingKernelManager, self).start_kernel(**kwargs)
self.set_kernel_for_notebook(notebook_id, kernel_id)

View File

@ -407,7 +407,6 @@ class NotebookApp(BaseIPythonApplication):
def init_configurables(self):
# force Session default to be secure
default_secure(self.config)
# Create a KernelManager and start a kernel.
self.kernel_manager = MappingKernelManager(
config=self.config, log=self.log, kernel_argv=self.kernel_argv,
connection_dir = self.profile_dir.security_dir,