mirror of
https://github.com/gryf/ebook-converter.git
synced 2026-03-18 15:53:41 +01:00
Get rid of polyglot as_unicode
This commit is contained in:
@@ -10,7 +10,6 @@ import urllib.parse
|
||||
|
||||
from ebook_converter import relpath, prints, force_unicode
|
||||
from ebook_converter.utils.config_base import tweaks
|
||||
from ebook_converter.polyglot.builtins import as_unicode
|
||||
from ebook_converter.polyglot.urllib import unquote
|
||||
|
||||
|
||||
@@ -268,17 +267,14 @@ class Resource(object):
|
||||
basedir = os.getcwd()
|
||||
if self.path is None:
|
||||
return self._href
|
||||
f = self.fragment.encode('utf-8') if isinstance(self.fragment, str) else self.fragment
|
||||
frag = '#'+as_unicode(urllib.parse.quote(f)) if self.fragment else ''
|
||||
frag = '#' + urllib.parse.quote(self.fragment) if self.fragment else ''
|
||||
if self.path == basedir:
|
||||
return ''+frag
|
||||
return '' + frag
|
||||
try:
|
||||
rpath = relpath(self.path, basedir)
|
||||
except OSError: # On windows path and basedir could be on different drives
|
||||
rpath = self.path
|
||||
if isinstance(rpath, str):
|
||||
rpath = rpath.encode('utf-8')
|
||||
return as_unicode(urllib.parse.quote(rpath.replace(os.sep, '/')))+frag
|
||||
return urllib.parse.quote(rpath.replace(os.sep, '/')) + frag
|
||||
|
||||
def set_basedir(self, path):
|
||||
self._basedir = path
|
||||
|
||||
@@ -32,7 +32,6 @@ from ebook_converter.utils.zipfile import ZipFile, safe_replace
|
||||
from odf.draw import Frame as odFrame, Image as odImage
|
||||
from odf.namespaces import DCNS, METANS, OFFICENS
|
||||
from odf.opendocument import load as odLoad
|
||||
from ebook_converter.polyglot.builtins import as_unicode
|
||||
|
||||
|
||||
fields = {
|
||||
@@ -240,7 +239,7 @@ def _set_metadata(raw, mi):
|
||||
add_user_metadata('opf.seriesindex', '{}'.format(mi.series_index))
|
||||
if not mi.is_null('identifiers'):
|
||||
remove_user_metadata('opf.identifiers')
|
||||
add_user_metadata('opf.identifiers', as_unicode(json.dumps(mi.identifiers)))
|
||||
add_user_metadata('opf.identifiers', str(json.dumps(mi.identifiers)))
|
||||
if not mi.is_null('rating'):
|
||||
remove_user_metadata('opf.rating')
|
||||
add_user_metadata('opf.rating', '%.2g' % mi.rating)
|
||||
|
||||
Reference in New Issue
Block a user