mirror of
https://github.com/gryf/ebook-converter.git
synced 2026-04-20 21:21:35 +02:00
Removed polyglots unicode_type usage
This commit is contained in:
@@ -16,7 +16,7 @@ from ebook_converter.ebooks.oeb.polish.utils import guess_type, extract
|
||||
from ebook_converter.ebooks.oeb.polish.opf import set_guide_item, get_book_language
|
||||
from ebook_converter.ebooks.oeb.polish.pretty import pretty_html_tree
|
||||
from ebook_converter.utils.localization import get_lang, canonicalize_lang, lang_as_iso639_1
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type
|
||||
from ebook_converter.polyglot.builtins import iteritems
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
@@ -170,11 +170,11 @@ def parse_ncx(container, ncx_name):
|
||||
toc_root.lang = toc_root.uid = None
|
||||
for attr, val in iteritems(root.attrib):
|
||||
if attr.endswith('lang'):
|
||||
toc_root.lang = unicode_type(val)
|
||||
toc_root.lang = str(val)
|
||||
break
|
||||
for uid in root.xpath('//*[calibre:lower-case(local-name()) = "meta" and @name="dtb:uid"]/@content'):
|
||||
if uid:
|
||||
toc_root.uid = unicode_type(uid)
|
||||
toc_root.uid = str(uid)
|
||||
break
|
||||
for pl in root.xpath('//*[calibre:lower-case(local-name()) = "pagelist"]'):
|
||||
for pt in pl.xpath('descendant::*[calibre:lower-case(local-name()) = "pagetarget"]'):
|
||||
@@ -581,9 +581,9 @@ def create_ncx(toc, to_href, btitle, lang, uid):
|
||||
nsmap={None: NCX_NS})
|
||||
head = etree.SubElement(ncx, NCX('head'))
|
||||
etree.SubElement(head, NCX('meta'),
|
||||
name='dtb:uid', content=unicode_type(uid))
|
||||
name='dtb:uid', content=str(uid))
|
||||
etree.SubElement(head, NCX('meta'),
|
||||
name='dtb:depth', content=unicode_type(toc.depth))
|
||||
name='dtb:depth', content=str(toc.depth))
|
||||
generator = ''.join(['calibre (', __version__, ')'])
|
||||
etree.SubElement(head, NCX('meta'),
|
||||
name='dtb:generator', content=generator)
|
||||
@@ -601,7 +601,7 @@ def create_ncx(toc, to_href, btitle, lang, uid):
|
||||
for child in toc_parent:
|
||||
play_order['c'] += 1
|
||||
point = etree.SubElement(xml_parent, NCX('navPoint'), id='num_%d' % play_order['c'],
|
||||
playOrder=unicode_type(play_order['c']))
|
||||
playOrder=str(play_order['c']))
|
||||
label = etree.SubElement(point, NCX('navLabel'))
|
||||
title = child.title
|
||||
if title:
|
||||
@@ -770,7 +770,7 @@ def commit_nav_toc(container, toc, lang=None, landmarks=None, previous_nav=None)
|
||||
for entry in toc.page_list:
|
||||
if container.has_name(entry['dest']) and container.mime_map[entry['dest']] in OEB_DOCS:
|
||||
a = create_li(ol, entry)
|
||||
a.text = unicode_type(entry['pagenum'])
|
||||
a.text = str(entry['pagenum'])
|
||||
pretty_xml_tree(nav)
|
||||
collapse_li(nav)
|
||||
container.replace(tocname, root)
|
||||
|
||||
Reference in New Issue
Block a user