From c260cb052b7cea5b5e43be29bfe57f3d384f2d21 Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Mon, 13 Dec 2010 19:11:41 +0000 Subject: [PATCH] Fix #7888: empty tags list throws exception in save_to_disk, converting the result to 'tags' --- src/calibre/library/save_to_disk.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/calibre/library/save_to_disk.py b/src/calibre/library/save_to_disk.py index af57d563ac..62a2e28e27 100644 --- a/src/calibre/library/save_to_disk.py +++ b/src/calibre/library/save_to_disk.py @@ -119,10 +119,8 @@ class SafeFormat(TemplateFormatter): try: b = self.book.get_user_metadata(key, False) except: - if DEBUG: - traceback.print_exc() + 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] @@ -135,8 +133,7 @@ class SafeFormat(TemplateFormatter): return val.replace('/', '_').replace('\\', '_') return '' except: - if DEBUG: - traceback.print_exc() + traceback.print_exc() return key def get_components(template, mi, id, timefmt='%b %Y', length=250, @@ -155,6 +152,8 @@ def get_components(template, mi, id, timefmt='%b %Y', length=250, format_args['tags'] = mi.format_tags() if format_args['tags'].startswith('/'): format_args['tags'] = format_args['tags'][1:] + else: + format_args['tags'] = '' if mi.series: format_args['series'] = tsfmt(mi.series) if mi.series_index is not None: