mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #7694 (Calibre-parallel.exe stopped working error: downlaoding NY Times)
This commit is contained in:
parent
030d4825fd
commit
7182f45c98
@ -362,6 +362,8 @@ def walk(dir):
|
|||||||
def strftime(fmt, t=None):
|
def strftime(fmt, t=None):
|
||||||
''' A version of strftime that returns unicode strings and tries to handle dates
|
''' A version of strftime that returns unicode strings and tries to handle dates
|
||||||
before 1900 '''
|
before 1900 '''
|
||||||
|
if not fmt:
|
||||||
|
return u''
|
||||||
if t is None:
|
if t is None:
|
||||||
t = time.localtime()
|
t = time.localtime()
|
||||||
if hasattr(t, 'timetuple'):
|
if hasattr(t, 'timetuple'):
|
||||||
@ -378,7 +380,8 @@ def strftime(fmt, t=None):
|
|||||||
if isinstance(fmt, unicode):
|
if isinstance(fmt, unicode):
|
||||||
fmt = fmt.encode('mbcs')
|
fmt = fmt.encode('mbcs')
|
||||||
ans = plugins['winutil'][0].strftime(fmt, t)
|
ans = plugins['winutil'][0].strftime(fmt, t)
|
||||||
ans = time.strftime(fmt, t).decode(preferred_encoding, 'replace')
|
else:
|
||||||
|
ans = time.strftime(fmt, t).decode(preferred_encoding, 'replace')
|
||||||
if early_year:
|
if early_year:
|
||||||
ans = ans.replace('_early year hack##', str(orig_year))
|
ans = ans.replace('_early year hack##', str(orig_year))
|
||||||
return ans
|
return ans
|
||||||
|
Loading…
x
Reference in New Issue
Block a user