mirror of https://gitlab.com/bashrc2/epicyon
Exception handling for date
parent
b715146a85
commit
97d6724e0d
|
@ -526,6 +526,7 @@ def _convertRSStoActivityPub(baseDir: str, httpPrefix: str,
|
|||
"""Converts rss items in a newswire into posts
|
||||
"""
|
||||
if not newswire:
|
||||
print('No newswire to convert')
|
||||
return
|
||||
|
||||
basePath = baseDir + '/accounts/news@' + domain + '/outbox'
|
||||
|
@ -542,8 +543,12 @@ def _convertRSStoActivityPub(baseDir: str, httpPrefix: str,
|
|||
dateStr = dateStr.replace(' ', 'T')
|
||||
dateStr = dateStr.replace('+00:00', 'Z')
|
||||
else:
|
||||
try:
|
||||
dateStrWithOffset = \
|
||||
datetime.datetime.strptime(dateStr, "%Y-%m-%d %H:%M:%S%z")
|
||||
except BaseException:
|
||||
print('Newswire strptime failed ' + str(dateStr))
|
||||
continue
|
||||
dateStr = dateStrWithOffset.strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
|
||||
statusNumber, published = getStatusNumber(dateStr)
|
||||
|
|
Loading…
Reference in New Issue