Skip to content

Commit 2a21e2a

Browse files
authored
Merge pull request #5544 from LaurMerl/custom-display-url
FIX: removed double link when custom_display_url (#5400)
2 parents 9fa644b + 95348dd commit 2a21e2a

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

notebook/notebookapp.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,7 +1777,8 @@ def display_url(self):
17771777
url = self._tcp_url(ip)
17781778
if self.token and not self.sock:
17791779
url = self._concat_token(url)
1780-
url += '\n or %s' % self._concat_token(self._tcp_url('127.0.0.1'))
1780+
if not self.custom_display_url:
1781+
url += '\n or %s' % self._concat_token(self._tcp_url('127.0.0.1'))
17811782
return url
17821783

17831784
@property
@@ -2216,13 +2217,22 @@ def start(self):
22162217
) % (self.sock, self._concat_token(self._tcp_url('localhost', 8888)))
22172218
]))
22182219
else:
2219-
self.log.critical('\n'.join([
2220-
'\n',
2221-
'To access the notebook, open this file in a browser:',
2222-
' %s' % urljoin('file:', pathname2url(self.browser_open_file)),
2223-
'Or copy and paste one of these URLs:',
2224-
' %s' % self.display_url,
2225-
]))
2220+
if not self.custom_display_url:
2221+
self.log.critical('\n'.join([
2222+
'\n',
2223+
'To access the notebook, open this file in a browser:',
2224+
' %s' % urljoin('file:', pathname2url(self.browser_open_file)),
2225+
'Or copy and paste one of these URLs:',
2226+
' %s' % self.display_url,
2227+
]))
2228+
else:
2229+
self.log.critical('\n'.join([
2230+
'\n',
2231+
'To access the notebook, open this file in a browser:',
2232+
' %s' % urljoin('file:', pathname2url(self.browser_open_file)),
2233+
'Or copy and paste this URL:',
2234+
' %s' % self.display_url,
2235+
]))
22262236

22272237
self.io_loop = ioloop.IOLoop.current()
22282238
if sys.platform.startswith('win'):

0 commit comments

Comments
 (0)