##// END OF EJS Templates
hgweb: remove dead code handling UnicodeDecodeError...
Manuel Jacob -
r50178:44b26349 default
parent child Browse files
Show More
@@ -8,7 +8,6 b''
8
8
9
9
10 import errno
10 import errno
11 import importlib
12 import os
11 import os
13 import socket
12 import socket
14 import sys
13 import sys
@@ -404,26 +403,9 b' def create_server(ui, app):'
404 cls = MercurialHTTPServer
403 cls = MercurialHTTPServer
405
404
406 # ugly hack due to python issue5853 (for threaded use)
405 # ugly hack due to python issue5853 (for threaded use)
407 try:
406 import mimetypes
408 import mimetypes
409
410 mimetypes.init()
411 except UnicodeDecodeError:
412 # Python 2.x's mimetypes module attempts to decode strings
413 # from Windows' ANSI APIs as ascii (fail), then re-encode them
414 # as ascii (clown fail), because the default Python Unicode
415 # codec is hardcoded as ascii.
416
407
417 sys.argv # unwrap demand-loader so that reload() works
408 mimetypes.init()
418 # resurrect sys.setdefaultencoding()
419 try:
420 importlib.reload(sys)
421 except AttributeError:
422 reload(sys)
423 oldenc = sys.getdefaultencoding()
424 sys.setdefaultencoding(b"latin1") # or any full 8-bit encoding
425 mimetypes.init()
426 sys.setdefaultencoding(oldenc)
427
409
428 address = ui.config(b'web', b'address')
410 address = ui.config(b'web', b'address')
429 port = urlutil.getport(ui.config(b'web', b'port'))
411 port = urlutil.getport(ui.config(b'web', b'port'))
@@ -20,7 +20,6 b' run pyflakes on all tracked files ending'
20 > 2>/dev/null \
20 > 2>/dev/null \
21 > | xargs "$PYTHON" -m pyflakes 2>/dev/null | "$TESTDIR/filterpyflakes.py"
21 > | xargs "$PYTHON" -m pyflakes 2>/dev/null | "$TESTDIR/filterpyflakes.py"
22 contrib/perf.py:*:* undefined name 'xrange' (glob) (?)
22 contrib/perf.py:*:* undefined name 'xrange' (glob) (?)
23 mercurial/hgweb/server.py:*:* undefined name 'reload' (glob) (?)
24 mercurial/pycompat.py:*:* 'codecs' imported but unused (glob)
23 mercurial/pycompat.py:*:* 'codecs' imported but unused (glob)
25 mercurial/pycompat.py:*:* 'concurrent.futures' imported but unused (glob)
24 mercurial/pycompat.py:*:* 'concurrent.futures' imported but unused (glob)
26 mercurial/pycompat.py:*:* 'http.client as httplib' imported but unused (glob)
25 mercurial/pycompat.py:*:* 'http.client as httplib' imported but unused (glob)
General Comments 0
You need to be logged in to leave comments. Login now