IGN:Pull from driver-dev

This commit is contained in:
Kovid Goyal 2009-05-31 15:20:00 -07:00
commit bae243edce
3 changed files with 5 additions and 4 deletions

View File

@ -34,7 +34,7 @@ class Writer(FormatWriter):
self.log.info('Compessing data...')
for i in range(0, len(txt_records)):
self.log.debug('\tCompressing record %i' % i)
txt_records[i] = compress_doc(txt_records[i].encode('utf-8'))
txt_records[i] = compress_doc(txt_records[i].encode('cp1252', 'replace'))
section_lengths.append(len(txt_records[i]))
out_stream.seek(0)

View File

@ -33,7 +33,7 @@ class Writer(FormatWriter):
self.log.info('Compressing data...')
for i in range(0, len(txt_records)):
self.log.debug('\tCompressing record %i' % i)
txt_records[i] = compressor.compress(txt_records[i].encode('utf-8'))
txt_records[i] = compressor.compress(txt_records[i].encode('cp1252', 'replace'))
txt_records[i] = txt_records[i] + compressor.flush(zlib.Z_FULL_FLUSH)
section_lengths.append(len(txt_records[i]))
crc32 = zlib.crc32(txt_records[i], crc32) & 0xffffffff

View File

@ -55,7 +55,7 @@ class Worker(Thread):
try:
Thread.run(self)
self.exception = self.traceback = None
except Exception, err:
except Exception as err:
self.exception = err
self.traceback = traceback.format_exc()
@ -543,8 +543,9 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
if isinstance(worker.exception, DRMError):
error_dialog(self, _('DRM Error'), _('<p>This book is protected by <a href="%s">DRM</a>')%'http://wiki.mobileread.com/wiki/DRM').exec_()
else:
r = getattr(worker.exception, 'reason', worker.exception)
error_dialog(self, _('Could not open ebook'),
unicode(worker.exception), det_msg=worker.traceback, show=True)
unicode(r), det_msg=worker.traceback, show=True)
self.close_progress_indicator()
else:
self.metadata.show_opf(self.iterator.opf)