From 66a99ce881ab4b276c693587fb7c723e15399075 Mon Sep 17 00:00:00 2001 From: Shreyas Cholia Date: Sat, 5 Mar 2016 12:05:58 -0800 Subject: [PATCH 1/3] Add support for default_url --- jupyterhub/spawner.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/jupyterhub/spawner.py b/jupyterhub/spawner.py index 1ad14d1f..673045f2 100644 --- a/jupyterhub/spawner.py +++ b/jupyterhub/spawner.py @@ -139,6 +139,13 @@ class Spawner(LoggingConfigurable): `%U` will be expanded to the user's username """ ) + + default_url = Unicode('', config=True, + help="""The default URL for the single-user server + + `%U` will be expanded to the user's username + """ + ) disable_user_config = Bool(False, config=True, help="""Disable per-user configuration of single-user servers. @@ -216,6 +223,10 @@ class Spawner(LoggingConfigurable): if self.notebook_dir: self.notebook_dir = self.notebook_dir.replace("%U",self.user.name) args.append('--notebook-dir=%s' % self.notebook_dir) + if self.default_url: + self.default_url = self.default_url.replace("%U",self.user.name) + args.append('--NotebookApp.default_url=%s' % self.default_url) + if self.debug: args.append('--debug') if self.disable_user_config: From 1a377bd03ad705748ce0da9cb8397032fbe418d9 Mon Sep 17 00:00:00 2001 From: Shreyas Cholia Date: Sat, 5 Mar 2016 12:16:10 -0800 Subject: [PATCH 2/3] comment on default_url being used with notebook_dir --- jupyterhub/spawner.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jupyterhub/spawner.py b/jupyterhub/spawner.py index 673045f2..454d1de8 100644 --- a/jupyterhub/spawner.py +++ b/jupyterhub/spawner.py @@ -141,8 +141,12 @@ class Spawner(LoggingConfigurable): ) default_url = Unicode('', config=True, - help="""The default URL for the single-user server - + help="""The default URL for the single-user server. + + Can be used in conjection with --notebook-dir=/ to enable + full filesystem traversal, while preserving user's homedir as + landing page for notebook + `%U` will be expanded to the user's username """ ) From 1316196542f02804a2df329a572db57d927bdccb Mon Sep 17 00:00:00 2001 From: shreddd Date: Sat, 5 Mar 2016 12:24:39 -0800 Subject: [PATCH 3/3] Update spawner.py type --- jupyterhub/spawner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jupyterhub/spawner.py b/jupyterhub/spawner.py index 454d1de8..019f1d55 100644 --- a/jupyterhub/spawner.py +++ b/jupyterhub/spawner.py @@ -143,7 +143,7 @@ class Spawner(LoggingConfigurable): default_url = Unicode('', config=True, help="""The default URL for the single-user server. - Can be used in conjection with --notebook-dir=/ to enable + Can be used in conjunction with --notebook-dir=/ to enable full filesystem traversal, while preserving user's homedir as landing page for notebook