##// END OF EJS Templates
Merge pull request #7078 from takluyver/kernelpath...
Matthias Bussonnier -
r19193:34a3b41d merge
parent child Browse files
Show More
@@ -611,9 +611,9 b' class FileContentsManager(ContentsManager):'
611 return "Serving notebooks from local directory: %s" % self.root_dir
611 return "Serving notebooks from local directory: %s" % self.root_dir
612
612
613 def get_kernel_path(self, path, model=None):
613 def get_kernel_path(self, path, model=None):
614 """Return the initial working dir a kernel associated with a given notebook"""
614 """Return the initial API path of a kernel associated with a given notebook"""
615 if '/' in path:
615 if '/' in path:
616 parent_dir = path.rsplit('/', 1)[0]
616 parent_dir = path.rsplit('/', 1)[0]
617 else:
617 else:
618 parent_dir = ''
618 parent_dir = ''
619 return self._get_os_path(parent_dir)
619 return parent_dir
@@ -187,8 +187,12 b' class ContentsManager(LoggingConfigurable):'
187
187
188 KernelManagers can turn this value into a filesystem path,
188 KernelManagers can turn this value into a filesystem path,
189 or ignore it altogether.
189 or ignore it altogether.
190
191 The default value here will start kernels in the directory of the
192 notebook server. FileContentsManager overrides this to use the
193 directory containing the notebook.
190 """
194 """
191 return path
195 return ''
192
196
193 def increment_filename(self, filename, path='', insert=''):
197 def increment_filename(self, filename, path='', insert=''):
194 """Increment a filename until it is unique.
198 """Increment a filename until it is unique.
@@ -54,14 +54,10 b' class MappingKernelManager(MultiKernelManager):'
54
54
55 def cwd_for_path(self, path):
55 def cwd_for_path(self, path):
56 """Turn API path into absolute OS path."""
56 """Turn API path into absolute OS path."""
57 # short circuit for NotebookManagers that pass in absolute paths
58 if os.path.exists(path):
59 return path
60
61 os_path = to_os_path(path, self.root_dir)
57 os_path = to_os_path(path, self.root_dir)
62 # in the case of notebooks and kernels not being on the same filesystem,
58 # in the case of notebooks and kernels not being on the same filesystem,
63 # walk up to root_dir if the paths don't exist
59 # walk up to root_dir if the paths don't exist
64 while not os.path.exists(os_path) and os_path != self.root_dir:
60 while not os.path.isdir(os_path) and os_path != self.root_dir:
65 os_path = os.path.dirname(os_path)
61 os_path = os.path.dirname(os_path)
66 return os_path
62 return os_path
67
63
General Comments 0
You need to be logged in to leave comments. Login now