Getting post content

merge-requests/30/head
Bob Mottram 2021-07-20 13:28:56 +01:00
parent 67670da87a
commit bb3dee7533
1 changed files with 4 additions and 3 deletions

View File

@ -37,14 +37,15 @@ def getContentFromPost(postJsonObject: {}, systemLanguage: str) -> str:
thisPostJson = postJsonObject['object']
if not thisPostJson.get('content'):
return ''
content = thisPostJson['content']
content = ''
if thisPostJson.get('contentMap'):
if isinstance(thisPostJson['contentMap'], dict):
if thisPostJson['contentMap'].get(systemLanguage):
if isinstance(thisPostJson['contentMap'][systemLanguage], str):
return thisPostJson['contentMap'][systemLanguage]
if not isinstance(content, str):
return ''
else:
if isinstance(thisPostJson['content'], str):
content = thisPostJson['content']
return content