py3: make user auth work; don't mess with encodings for strftime

The Windows-specific hack initially added in commit
8743efbed1e54d8dd4e71ba71ebd5a7806564270 should be able to be removed
now as it is no longer necessary. The python encoding on Windows is sane
in python3.
This commit is contained in:
Eli Schwartz 2019-05-09 13:26:33 -04:00
parent ba0a4992b6
commit aa8efc504d
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6

View File

@ -22,7 +22,7 @@ from calibre.utils.shared_file import share_open, raise_winerror
from polyglot.builtins import iteritems, map, range from polyglot.builtins import iteritems, map, range
from polyglot import reprlib from polyglot import reprlib
from polyglot.http_cookie import SimpleCookie from polyglot.http_cookie import SimpleCookie
from polyglot.builtins import unicode_type from polyglot.builtins import is_py3, unicode_type
from polyglot.urllib import parse_qs, quote as urlquote from polyglot.urllib import parse_qs, quote as urlquote
from polyglot.binary import as_hex_unicode as encode_name, from_hex_unicode as decode_name from polyglot.binary import as_hex_unicode as encode_name, from_hex_unicode as decode_name
@ -530,10 +530,9 @@ def get_use_roman():
return _use_roman return _use_roman
if iswindows: if iswindows and not is_py3:
def fast_now_strftime(fmt): def fast_now_strftime(fmt):
fmt = fmt.encode('mbcs') return time.strftime(fmt).encode('mbcs', 'replace').decode('mbcs')
return time.strftime(fmt).decode('mbcs', 'replace')
else: else:
def fast_now_strftime(fmt): def fast_now_strftime(fmt):
return time.strftime(fmt).decode('utf-8', 'replace') return time.strftime(fmt)