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 35
35
36
36
from traitlets .config import Application
37
37
from ipython_genutils .path import filefind
38
- from ipython_genutils .py3compat import string_types
38
+ from ipython_genutils .py3compat import string_types , PY3
39
39
40
40
import notebook
41
41
from notebook ._tz import utcnow
@@ -427,11 +427,15 @@ def check_host(self):
427
427
if host .startswith ('[' ) and host .endswith (']' ):
428
428
host = host [1 :- 1 ]
429
429
430
+ if not PY3 :
431
+ # ip_address only accepts unicode on Python 2
432
+ host = host .decode ('utf8' , 'replace' )
433
+
430
434
try :
431
435
addr = ipaddress .ip_address (host )
432
436
except ValueError :
433
437
# 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' ])
435
439
else :
436
440
allow = addr .is_loopback
437
441
You can’t perform that action at this time.
0 commit comments