File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 3535
3636from traitlets .config import Application
3737from ipython_genutils .path import filefind
38- from ipython_genutils .py3compat import string_types
38+ from ipython_genutils .py3compat import string_types , PY3
3939
4040import notebook
4141from notebook ._tz import utcnow
@@ -427,11 +427,15 @@ def check_host(self):
427427 if host .startswith ('[' ) and host .endswith (']' ):
428428 host = host [1 :- 1 ]
429429
430+ if not PY3 :
431+ # ip_address only accepts unicode on Python 2
432+ host = host .decode ('utf8' , 'replace' )
433+
430434 try :
431435 addr = ipaddress .ip_address (host )
432436 except ValueError :
433437 # Not an IP address: check against hostnames
434- allow = host in self .settings .get ('local_hostnames' , [])
438+ allow = host in self .settings .get ('local_hostnames' , ['localhost' ])
435439 else :
436440 allow = addr .is_loopback
437441
You can’t perform that action at this time.
0 commit comments