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.
This commit is contained in:
MinRK 2013-11-15 10:35:34 -08:00
parent 6070b98c87
commit 24e5153246

View File

@ -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)