From 56ed85312269d1429338839a9a4d9b77f96b356b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 3 Aug 2011 23:34:22 -0600 Subject: [PATCH] ... --- src/calibre/ebooks/mobi/debug.py | 5 +++-- src/calibre/ebooks/mobi/writer2/indexer.py | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/calibre/ebooks/mobi/debug.py b/src/calibre/ebooks/mobi/debug.py index 0c45a8078a..af5238db70 100644 --- a/src/calibre/ebooks/mobi/debug.py +++ b/src/calibre/ebooks/mobi/debug.py @@ -766,6 +766,7 @@ class IndexEntry(object): # {{{ flags = self.flags for tag in expected_tags: vals = [] + if tag.tag > 64: has_tag = flags & 0b1 flags = flags >> 1 @@ -781,8 +782,8 @@ class IndexEntry(object): # {{{ self.consumed = len(orig_raw) - len(raw) self.trailing_bytes = raw if self.trailing_bytes.replace(b'\0', b''): - raise ValueError('IndexEntry has leftover bytes: %s'%format_bytes( - self.trailing_bytes)) + raise ValueError('%s has leftover bytes: %s'%(self, format_bytes( + self.trailing_bytes))) @property def label(self): diff --git a/src/calibre/ebooks/mobi/writer2/indexer.py b/src/calibre/ebooks/mobi/writer2/indexer.py index 60b5f001cf..76a2bc4a6f 100644 --- a/src/calibre/ebooks/mobi/writer2/indexer.py +++ b/src/calibre/ebooks/mobi/writer2/indexer.py @@ -97,7 +97,8 @@ class TAGX(object): # {{{ ''' TAGX block for the Primary index header of a periodical ''' - map(self.add_tag, (1, 2, 3, 4, 5, 21, 22, 23, 0, 69, 70, 71, 72, 73, 0)) + list(map(self.add_tag, (1, 2, 3, 4, 5, 21, 22, 23, 0, 69, 70, 71, 72, + 73, 0))) return self.header(2) + bytes(self.byts) @property @@ -105,7 +106,7 @@ class TAGX(object): # {{{ ''' TAGX block for the secondary index header of a periodical ''' - map(self.add_tag, (11, 0)) + list(map(self.add_tag, (11, 0))) return self.header(1) + bytes(self.byts) @property @@ -113,7 +114,7 @@ class TAGX(object): # {{{ ''' TAGX block for the primary index header of a flat book ''' - map(self.add_tag, (1, 2, 3, 4, 0)) + list(map(self.add_tag, (1, 2, 3, 4, 0))) return self.header(1) + bytes(self.byts) # }}}