##// END OF EJS Templates
Clean up get_kernel_path logic
Thomas Kluyver -
Show More
@@ -21,13 +21,3 b' class ClientSideContentsManager(ContentsManager):'
21
21
22 def file_exists(self, name, path=''):
22 def file_exists(self, name, path=''):
23 return True
23 return True
24
25 def get_kernel_path(self, path, model=None):
26 """Return the API path for the kernel
27
28 KernelManagers can turn this value into a filesystem path,
29 or ignore it altogether.
30
31 Here just always return home directory
32 """
33 return '/'
@@ -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