mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
fix None args to empty
This commit is contained in:
parent
56e482aeb1
commit
62cda3ea2f
@ -896,8 +896,9 @@ class FormatterFuncsCaller():
|
|||||||
|
|
||||||
if func_name:
|
if func_name:
|
||||||
def call(*args, **kargs):
|
def call(*args, **kargs):
|
||||||
args = [str(a) for a in args]
|
args = [str('' if a is None else a) for a in args]
|
||||||
kargs = {k:str(v if v else '') for k,v in kargs.items()}
|
kargs = {k:str('' if v is None else v) for k,v in kargs.items()}
|
||||||
|
|
||||||
|
|
||||||
def raise_error(msg):
|
def raise_error(msg):
|
||||||
raise ValueError(msg)
|
raise ValueError(msg)
|
||||||
@ -1715,7 +1716,7 @@ class TemplateFormatter(string.Formatter):
|
|||||||
if getattr(e, 'is_internal', False):
|
if getattr(e, 'is_internal', False):
|
||||||
# Exception raised by FormatterFuncsCaller
|
# Exception raised by FormatterFuncsCaller
|
||||||
# get the line inside the current template instead of the FormatterFuncsCaller
|
# get the line inside the current template instead of the FormatterFuncsCaller
|
||||||
for s in reversed(traceback.extract_tb(exc_info()[2])):
|
for s in reversed(stack):
|
||||||
if s.filename == '<string>':
|
if s.filename == '<string>':
|
||||||
ss = s
|
ss = s
|
||||||
break
|
break
|
||||||
|
Loading…
x
Reference in New Issue
Block a user