mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-28 23:17:35 +01: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
3 changed files with 4 additions and 4 deletions
|
|
@ -351,7 +351,7 @@ def parse_details(self, raw, root):
|
|||
if self.testing:
|
||||
import tempfile
|
||||
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:
|
||||
f.write(raw)
|
||||
print('Downloaded html for', asin, 'saved in', f.name)
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ def get_basic_data(browser, log, *skus):
|
|||
'orderID': '0',
|
||||
'mailingID': '',
|
||||
'tContentWidth': '926',
|
||||
'originalOrder': ','.join(str(i) for i in range(len(skus))),
|
||||
'originalOrder': ','.join(type('')(i) for i in range(len(skus))),
|
||||
'selectedOrderID': '0',
|
||||
'selectedSortColumn': '0',
|
||||
'listType': '1',
|
||||
|
|
@ -255,7 +255,7 @@ def create_query(self, log, title=None, authors=None, identifiers={}):
|
|||
return None
|
||||
params = {
|
||||
'q': (' '.join(keywords)).encode('utf-8'),
|
||||
'_': str(int(time.time()))
|
||||
'_': type('')(int(time.time()))
|
||||
}
|
||||
return BASE_URL+urlencode(params)
|
||||
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ def get_text(extra, x):
|
|||
# ISBN
|
||||
isbns = []
|
||||
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() == 'ISBN:':
|
||||
t = check_isbn(t[5:])
|
||||
|
|
|
|||
Loading…
Reference in a new issue