Skip to content

Commit

Permalink
Merge pull request jupyter-server#400 from minrk/root-dir-priority
Browse files Browse the repository at this point in the history
only use deprecated notebook_dir config if root_dir is not set
  • Loading branch information
Zsailer authored Feb 3, 2021
2 parents 6b68210 + db4f597 commit 01ee956
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion jupyter_server/serverapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1264,16 +1264,22 @@ def _update_pylab(self, change):

@observe('notebook_dir')
def _update_notebook_dir(self, change):
if self._root_dir_set:
# only use deprecated config if new config is not set
return
self.log.warning(_("notebook_dir is deprecated, use root_dir"))
self.root_dir = change['new']

root_dir = Unicode(config=True,
root_dir = Unicode(
config=True,
help=_("The directory to use for notebooks and kernels.")
)
_root_dir_set = False

@default('root_dir')
def _default_root_dir(self):
if self.file_to_run:
self._root_dir_set = True
return os.path.dirname(os.path.abspath(self.file_to_run))
else:
return py3compat.getcwd()
Expand All @@ -1294,6 +1300,10 @@ def _root_dir_validate(self, proposal):
raise TraitError(trans.gettext("No such notebook dir: '%r'") % value)
return value

@observe('root_dir')
def _root_dir_changed(self, change):
self._root_dir_set = True

@observe('server_extensions')
def _update_server_extensions(self, change):
self.log.warning(_("server_extensions is deprecated, use jpserver_extensions"))
Expand Down

0 comments on commit 01ee956

Please sign in to comment.