mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-09 04:26:12 +01:00
Dont use str(soup)
This commit is contained in:
parent
19d4a453e8
commit
2fc337d779
1 changed files with 2 additions and 2 deletions
|
|
@ -144,7 +144,7 @@ def ExtractFiles(self, output_dir=os.getcwdu(), debug_dump=False):
|
|||
import shutil
|
||||
shutil.copytree(output_dir, os.path.join(debug_dump, 'debug_dump'))
|
||||
for lpath in html_files:
|
||||
with open(lpath, 'r+b') as f:
|
||||
with lopen(lpath, 'r+b') as f:
|
||||
data = f.read()
|
||||
data = self._reformat(data, lpath)
|
||||
if isinstance(data, unicode_type):
|
||||
|
|
@ -262,7 +262,7 @@ def _reformat(self, data, htmlpath):
|
|||
pass
|
||||
# do not prettify, it would reformat the <pre> tags!
|
||||
try:
|
||||
ans = str(soup)
|
||||
ans = soup.decode_contents()
|
||||
self.re_encoded_files.add(os.path.abspath(htmlpath))
|
||||
return ans
|
||||
except RuntimeError:
|
||||
|
|
|
|||
Loading…
Reference in a new issue