Show More
@@ -410,6 +410,19 b' class NotebookApp(BaseIPythonApplication):' | |||||
410 | ip = Unicode('localhost', config=True, |
|
410 | ip = Unicode('localhost', config=True, | |
411 | help="The IP address the notebook server will listen on." |
|
411 | help="The IP address the notebook server will listen on." | |
412 | ) |
|
412 | ) | |
|
413 | def _ip_default(self): | |||
|
414 | """Return localhost if available, 127.0.0.1 otherwise. | |||
|
415 | ||||
|
416 | On some (horribly broken) systems, localhost cannot be bound. | |||
|
417 | """ | |||
|
418 | s = socket.socket() | |||
|
419 | try: | |||
|
420 | s.bind(('localhost', 0)) | |||
|
421 | except socket.error: | |||
|
422 | return '127.0.0.1' | |||
|
423 | else: | |||
|
424 | s.close() | |||
|
425 | return 'localhost' | |||
413 |
|
426 | |||
414 | def _ip_changed(self, name, old, new): |
|
427 | def _ip_changed(self, name, old, new): | |
415 | if new == u'*': self.ip = u'' |
|
428 | if new == u'*': self.ip = u'' |
General Comments 0
You need to be logged in to leave comments.
Login now