From 24e5153246c5d40212d962e1827d9814c966d623 Mon Sep 17 00:00:00 2001 From: MinRK Date: Fri, 15 Nov 2013 10:35:34 -0800 Subject: [PATCH] fix warning condition on notebook startup should have only warned if file_to_run is defined *and* it's outside the notebook_dir, but warning was shown even if it was not specified. --- IPython/html/notebookapp.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/IPython/html/notebookapp.py b/IPython/html/notebookapp.py index 002f98406..5c6850001 100644 --- a/IPython/html/notebookapp.py +++ b/IPython/html/notebookapp.py @@ -715,14 +715,15 @@ class NotebookApp(BaseIPythonApplication): nbdir = os.path.abspath(self.notebook_manager.notebook_dir) f = self.file_to_run - if f and f.startswith(nbdir): - f = f[len(nbdir):] - else: - self.log.warn( - "Probably won't be able to open notebook %s " - "because it is not in notebook_dir %s", - f, nbdir, - ) + if f: + if f.startswith(nbdir): + f = f[len(nbdir):] + else: + self.log.warn( + "Probably won't be able to open notebook %s " + "because it is not in notebook_dir %s", + f, nbdir, + ) if os.path.isfile(self.file_to_run): url = url_path_join('notebooks', f)