mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
py3: use unicode literals for casting strings
Since unicode_type cannot be used in dynamically updated code, cast to the same type as type('') -- which we know will be unicode because of unicode_literals.
This commit is contained in:
parent
7c89277408
commit
0048c43a9e
@ -351,7 +351,7 @@ class Worker(Thread): # Get details {{{
|
|||||||
if self.testing:
|
if self.testing:
|
||||||
import tempfile
|
import tempfile
|
||||||
import uuid
|
import uuid
|
||||||
with tempfile.NamedTemporaryFile(prefix=(asin or str(uuid.uuid4())) + '_',
|
with tempfile.NamedTemporaryFile(prefix=(asin or type('')(uuid.uuid4())) + '_',
|
||||||
suffix='.html', delete=False) as f:
|
suffix='.html', delete=False) as f:
|
||||||
f.write(raw)
|
f.write(raw)
|
||||||
print('Downloaded html for', asin, 'saved in', f.name)
|
print('Downloaded html for', asin, 'saved in', f.name)
|
||||||
|
@ -139,7 +139,7 @@ def get_basic_data(browser, log, *skus):
|
|||||||
'orderID': '0',
|
'orderID': '0',
|
||||||
'mailingID': '',
|
'mailingID': '',
|
||||||
'tContentWidth': '926',
|
'tContentWidth': '926',
|
||||||
'originalOrder': ','.join(str(i) for i in range(len(skus))),
|
'originalOrder': ','.join(type('')(i) for i in range(len(skus))),
|
||||||
'selectedOrderID': '0',
|
'selectedOrderID': '0',
|
||||||
'selectedSortColumn': '0',
|
'selectedSortColumn': '0',
|
||||||
'listType': '1',
|
'listType': '1',
|
||||||
@ -255,7 +255,7 @@ class Edelweiss(Source):
|
|||||||
return None
|
return None
|
||||||
params = {
|
params = {
|
||||||
'q': (' '.join(keywords)).encode('utf-8'),
|
'q': (' '.join(keywords)).encode('utf-8'),
|
||||||
'_': str(int(time.time()))
|
'_': type('')(int(time.time()))
|
||||||
}
|
}
|
||||||
return BASE_URL+urlencode(params)
|
return BASE_URL+urlencode(params)
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ def to_metadata(browser, log, entry_, timeout): # {{{
|
|||||||
# ISBN
|
# ISBN
|
||||||
isbns = []
|
isbns = []
|
||||||
for x in identifier(extra):
|
for x in identifier(extra):
|
||||||
t = str(x.text).strip()
|
t = type('')(x.text).strip()
|
||||||
if t[:5].upper() in ('ISBN:', 'LCCN:', 'OCLC:'):
|
if t[:5].upper() in ('ISBN:', 'LCCN:', 'OCLC:'):
|
||||||
if t[:5].upper() == 'ISBN:':
|
if t[:5].upper() == 'ISBN:':
|
||||||
t = check_isbn(t[5:])
|
t = check_isbn(t[5:])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user