forked from indymedia/epicyon
Less indentation
parent
aea95f131f
commit
963f8dc696
|
@ -588,28 +588,32 @@ def getPublishedDateStr(postJsonObject: {},
|
||||||
"""Return the html for the published date on a post
|
"""Return the html for the published date on a post
|
||||||
"""
|
"""
|
||||||
publishedStr = ''
|
publishedStr = ''
|
||||||
if postJsonObject['object'].get('published'):
|
|
||||||
publishedStr = postJsonObject['object']['published']
|
if not postJsonObject['object'].get('published'):
|
||||||
if '.' not in publishedStr:
|
return publishedStr
|
||||||
if '+' not in publishedStr:
|
|
||||||
datetimeObject = \
|
publishedStr = postJsonObject['object']['published']
|
||||||
datetime.strptime(publishedStr, "%Y-%m-%dT%H:%M:%SZ")
|
if '.' not in publishedStr:
|
||||||
else:
|
if '+' not in publishedStr:
|
||||||
datetimeObject = \
|
datetimeObject = \
|
||||||
datetime.strptime(publishedStr.split('+')[0] + 'Z',
|
datetime.strptime(publishedStr, "%Y-%m-%dT%H:%M:%SZ")
|
||||||
"%Y-%m-%dT%H:%M:%SZ")
|
|
||||||
else:
|
else:
|
||||||
publishedStr = \
|
datetimeObject = \
|
||||||
publishedStr.replace('T', ' ').split('.')[0]
|
datetime.strptime(publishedStr.split('+')[0] + 'Z',
|
||||||
datetimeObject = parse(publishedStr)
|
"%Y-%m-%dT%H:%M:%SZ")
|
||||||
if not showPublishedDateOnly:
|
else:
|
||||||
publishedStr = datetimeObject.strftime("%a %b %d, %H:%M")
|
publishedStr = \
|
||||||
else:
|
publishedStr.replace('T', ' ').split('.')[0]
|
||||||
publishedStr = datetimeObject.strftime("%a %b %d")
|
datetimeObject = parse(publishedStr)
|
||||||
# if the post has replies then append a symbol to indicate this
|
if not showPublishedDateOnly:
|
||||||
if postJsonObject.get('hasReplies'):
|
publishedStr = datetimeObject.strftime("%a %b %d, %H:%M")
|
||||||
if postJsonObject['hasReplies'] is True:
|
else:
|
||||||
publishedStr = '[' + publishedStr + ']'
|
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:
|
||||||
|
publishedStr = '[' + publishedStr + ']'
|
||||||
return publishedStr
|
return publishedStr
|
||||||
|
|
||||||
|
|
||||||
|
@ -620,26 +624,31 @@ def getBlogCitationsHtml(boxName: str,
|
||||||
"""
|
"""
|
||||||
# show blog citations
|
# show blog citations
|
||||||
citationsStr = ''
|
citationsStr = ''
|
||||||
if boxName == 'tlblogs' or boxName == 'tlfeatures':
|
if not (boxName == 'tlblogs' or boxName == 'tlfeatures'):
|
||||||
if postJsonObject['object'].get('tag'):
|
return citationsStr
|
||||||
for tagJson in postJsonObject['object']['tag']:
|
|
||||||
if not isinstance(tagJson, dict):
|
if not postJsonObject['object'].get('tag'):
|
||||||
continue
|
return citationsStr
|
||||||
if not tagJson.get('type'):
|
|
||||||
continue
|
for tagJson in postJsonObject['object']['tag']:
|
||||||
if tagJson['type'] != 'Article':
|
if not isinstance(tagJson, dict):
|
||||||
continue
|
continue
|
||||||
if not tagJson.get('name'):
|
if not tagJson.get('type'):
|
||||||
continue
|
continue
|
||||||
if not tagJson.get('url'):
|
if tagJson['type'] != 'Article':
|
||||||
continue
|
continue
|
||||||
citationsStr += \
|
if not tagJson.get('name'):
|
||||||
'<li><a href="' + tagJson['url'] + '">' + \
|
continue
|
||||||
'<cite>' + tagJson['name'] + '</cite></a></li>\n'
|
if not tagJson.get('url'):
|
||||||
if citationsStr:
|
continue
|
||||||
citationsStr = '<p><b>' + translate['Citations'] + \
|
citationsStr += \
|
||||||
':</b></p>' + \
|
'<li><a href="' + tagJson['url'] + '">' + \
|
||||||
'<ul>\n' + citationsStr + '</ul>\n'
|
'<cite>' + tagJson['name'] + '</cite></a></li>\n'
|
||||||
|
|
||||||
|
if citationsStr:
|
||||||
|
citationsStr = '<p><b>' + translate['Citations'] + \
|
||||||
|
':</b></p>' + \
|
||||||
|
'<ul>\n' + citationsStr + '</ul>\n'
|
||||||
return citationsStr
|
return citationsStr
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue