Less indentation

main
Bob Mottram 2020-12-01 10:19:53 +00:00
parent aea95f131f
commit 963f8dc696
1 changed files with 50 additions and 41 deletions

View File

@ -588,7 +588,10 @@ def getPublishedDateStr(postJsonObject: {},
"""Return the html for the published date on a post
"""
publishedStr = ''
if postJsonObject['object'].get('published'):
if not postJsonObject['object'].get('published'):
return publishedStr
publishedStr = postJsonObject['object']['published']
if '.' not in publishedStr:
if '+' not in publishedStr:
@ -606,6 +609,7 @@ def getPublishedDateStr(postJsonObject: {},
publishedStr = datetimeObject.strftime("%a %b %d, %H:%M")
else:
publishedStr = datetimeObject.strftime("%a %b %d")
# if the post has replies then append a symbol to indicate this
if postJsonObject.get('hasReplies'):
if postJsonObject['hasReplies'] is True:
@ -620,8 +624,12 @@ def getBlogCitationsHtml(boxName: str,
"""
# show blog citations
citationsStr = ''
if boxName == 'tlblogs' or boxName == 'tlfeatures':
if postJsonObject['object'].get('tag'):
if not (boxName == 'tlblogs' or boxName == 'tlfeatures'):
return citationsStr
if not postJsonObject['object'].get('tag'):
return citationsStr
for tagJson in postJsonObject['object']['tag']:
if not isinstance(tagJson, dict):
continue
@ -636,6 +644,7 @@ def getBlogCitationsHtml(boxName: str,
citationsStr += \
'<li><a href="' + tagJson['url'] + '">' + \
'<cite>' + tagJson['name'] + '</cite></a></li>\n'
if citationsStr:
citationsStr = '<p><b>' + translate['Citations'] + \
':</b></p>' + \