Check newswire for no return value

merge-requests/30/head
Bob Mottram 2020-11-03 14:41:28 +00:00
parent 9f70a96f51
commit 4c1553e1e7
2 changed files with 8 additions and 0 deletions

View File

@ -471,6 +471,9 @@ def convertRSStoActivityPub(baseDir: str, httpPrefix: str,
maxMirroredArticles: int) -> None: maxMirroredArticles: int) -> None:
"""Converts rss items in a newswire into posts """Converts rss items in a newswire into posts
""" """
if not newswire:
return
basePath = baseDir + '/accounts/news@' + domain + '/outbox' basePath = baseDir + '/accounts/news@' + domain + '/outbox'
if not os.path.isdir(basePath): if not os.path.isdir(basePath):
os.mkdir(basePath) os.mkdir(basePath)
@ -669,6 +672,9 @@ def mergeWithPreviousNewswire(oldNewswire: {}, newNewswire: {}) -> None:
"""Preserve any votes or generated activitypub post filename """Preserve any votes or generated activitypub post filename
as rss feeds are updated as rss feeds are updated
""" """
if not oldNewswire:
return
for published, fields in oldNewswire.items(): for published, fields in oldNewswire.items():
if not newNewswire.get(published): if not newNewswire.get(published):
continue continue

View File

@ -354,6 +354,8 @@ def getRSSfromDict(baseDir: str, newswire: {},
rssStr = rss2Header(httpPrefix, rssStr = rss2Header(httpPrefix,
None, domainFull, None, domainFull,
'Newswire', translate) 'Newswire', translate)
if not newswire:
return ''
for published, fields in newswire.items(): for published, fields in newswire.items():
if '+00:00' in published: if '+00:00' in published:
published = published.replace('+00:00', 'Z').strip() published = published.replace('+00:00', 'Z').strip()