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
|
"""Converts rss items in a newswire into posts
|
||||||
"""
|
"""
|
||||||
if not newswire:
|
if not newswire:
|
||||||
|
print('No newswire to convert')
|
||||||
return
|
return
|
||||||
|
|
||||||
basePath = baseDir + '/accounts/news@' + domain + '/outbox'
|
basePath = baseDir + '/accounts/news@' + domain + '/outbox'
|
||||||
|
@ -542,8 +543,12 @@ def _convertRSStoActivityPub(baseDir: str, httpPrefix: str,
|
||||||
dateStr = dateStr.replace(' ', 'T')
|
dateStr = dateStr.replace(' ', 'T')
|
||||||
dateStr = dateStr.replace('+00:00', 'Z')
|
dateStr = dateStr.replace('+00:00', 'Z')
|
||||||
else:
|
else:
|
||||||
dateStrWithOffset = \
|
try:
|
||||||
datetime.datetime.strptime(dateStr, "%Y-%m-%d %H:%M:%S%z")
|
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")
|
dateStr = dateStrWithOffset.strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||||
|
|
||||||
statusNumber, published = getStatusNumber(dateStr)
|
statusNumber, published = getStatusNumber(dateStr)
|
||||||
|
|
Loading…
Reference in New Issue