From 9d584829447c07147669f1416454bd97b56f640f Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Thu, 18 Sep 2014 14:32:25 +0200 Subject: [PATCH] Expand user home path in template search path. cause that pretty much always what you want to do if you have a `~` ina path. --- IPython/html/notebookapp.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/IPython/html/notebookapp.py b/IPython/html/notebookapp.py index c56658fe7..1e6f2646e 100644 --- a/IPython/html/notebookapp.py +++ b/IPython/html/notebookapp.py @@ -142,13 +142,17 @@ class NotebookWebApplication(web.Application): # make the patterns unicode, and ultimately result in unicode # keys in kwargs to handler._execute(**kwargs) in tornado. # This enforces that base_url be ascii in that situation. - # + # # Note that the URLs these patterns check against are escaped, # and thus guaranteed to be ASCII: 'héllo' is really 'h%C3%A9llo'. base_url = py3compat.unicode_to_str(base_url, 'ascii') - template_path = settings_overrides.get("template_path", os.path.join(os.path.dirname(__file__), "templates")) + _template_path = settings_overrides.get("template_path", os.path.join(os.path.dirname(__file__), "templates")) + if isinstance(_template_path, str): + _template_path = (_template_path,) + template_path = [os.path.expanduser(path) for path in _template_path] + jenv_opt = jinja_env_options if jinja_env_options else {} - env = Environment(loader=FileSystemLoader(template_path),**jenv_opt ) + env = Environment(loader=FileSystemLoader(template_path), **jenv_opt) settings = dict( # basics log_function=log_request,