mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
ebook-meta: fix an error when using an rmpty string as the rating on epub 2
This commit is contained in:
parent
b530b8313d
commit
0035170828
@ -1315,7 +1315,7 @@ class OPF(object): # {{{
|
|||||||
val = getattr(mi, attr, None)
|
val = getattr(mi, attr, None)
|
||||||
if attr == 'rating' and val:
|
if attr == 'rating' and val:
|
||||||
val = float(val)
|
val = float(val)
|
||||||
is_null = val is None or val in ((), [], (None, None), {}) or (attr == 'rating' and val < 0.1)
|
is_null = val is None or val in ((), [], (None, None), {}) or (attr == 'rating' and (not val or val < 0.1))
|
||||||
if is_null:
|
if is_null:
|
||||||
if apply_null and attr in {'series', 'tags', 'isbn', 'comments', 'publisher', 'rating'}:
|
if apply_null and attr in {'series', 'tags', 'isbn', 'comments', 'publisher', 'rating'}:
|
||||||
setattr(self, attr, ([] if attr == 'tags' else None))
|
setattr(self, attr, ([] if attr == 'tags' else None))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user