From 1e9e1593d0ca057e5b3b8a25534f4c3da5c46f35 Mon Sep 17 00:00:00 2001 From: eric Date: Thu, 27 Aug 2020 17:59:16 -0400 Subject: [PATCH] fix issue with books missing titles --- CoverPages.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/CoverPages.py b/CoverPages.py index 7354899..f2e1932 100644 --- a/CoverPages.py +++ b/CoverPages.py @@ -39,10 +39,13 @@ class CoverPages(object): for row in rows: url = '/' + row.filename href = '/ebooks/%d' % row.pk - title = gg.xmlspecialchars (row.title) # handles <,>,& - #Shortening long titles for latest covers - title = title.replace('"', '"') - title = title.replace("'", ''') + if row.title: + title = gg.xmlspecialchars (row.title) # handles <,>,& + #Shortening long titles for latest covers + title = title.replace('"', '"') + title = title.replace("'", ''') + else: + title = '!! missing title !!' short_title = title title_len = len(title) short_title = re.sub(r"\-+", " ", short_title)