View Single Post
Old 06-29-2014, 10:52 AM   #840
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,932
Karma: 6361444
Join Date: Nov 2009
Device: many
Quote:
Originally Posted by tkeo View Post
Hi Kevin,


The posted patch fixes the bug that cover image is not renamed when cover_offset = 0 due to bool(0) == False.

This happens with the mobi file krzyzacy-tom-pierwszy.mobi, posted:
https://www.mobileread.com/forums/sho...&postcount=693


EDIT: Attached CODE is removed because I have mistaken something in it.
Please try this:
Code:

Code:

Thanks,
Thanks for catching that. I did not think the cover offset could ever be 0 but I guess it could be if there is no thumbnail and no other images.

In an effort to help track down other mistakes like that, I have changed the entire code base to use the python.org PEP recommendation when testing against None as follows:

I have changed all:
== None
to:
is None

And changed all:
!= None
to:
is not None

Now any testing against 0 vs non-zero using "if variable" will stand out as different and I can track down any such occurrences to make sure they were not using it to test against None but were instead looking at the non-zero case.

I have attached a patch to move us to follow the python PEP recommendation.
See pep_use_patch.txt

Nicely done!

KevinH
Attached Files
File Type: txt pep_use_patch.txt (32.2 KB, 254 views)

Last edited by KevinH; 06-29-2014 at 12:31 PM.
KevinH is offline   Reply With Quote