mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Print exception messages in save-to-disk get_value
This commit is contained in:
parent
74d7cd9498
commit
c3438172ba
@ -114,8 +114,14 @@ class SafeFormat(TemplateFormatter):
|
||||
|
||||
def get_value(self, key, args, kwargs):
|
||||
try:
|
||||
b = self.book.get_user_metadata(key, False)
|
||||
key = key.lower()
|
||||
try:
|
||||
b = self.book.get_user_metadata(key, False)
|
||||
except:
|
||||
print 'save_to_disk get value exception'
|
||||
traceback.print_exc()
|
||||
b = None
|
||||
|
||||
if b is not None and b['datatype'] == 'composite':
|
||||
if key in self.composite_values:
|
||||
return self.composite_values[key]
|
||||
@ -124,9 +130,11 @@ class SafeFormat(TemplateFormatter):
|
||||
self.vformat(b['display']['composite_template'], [], kwargs)
|
||||
return self.composite_values[key]
|
||||
if kwargs[key]:
|
||||
return self.sanitize(kwargs[key.lower()])
|
||||
return self.sanitize(kwargs[key])
|
||||
return ''
|
||||
except:
|
||||
print 'save_to_disk general exception'
|
||||
traceback.print_exc()
|
||||
return ''
|
||||
|
||||
safe_formatter = SafeFormat()
|
||||
|
Loading…
x
Reference in New Issue
Block a user