Less verbose when not in debug

merge-requests/30/head
Bob Mottram 2021-03-14 19:32:11 +00:00
parent e3971c1720
commit a4b7b921de
4 changed files with 12 additions and 10 deletions

View File

@ -414,6 +414,7 @@ def savePostToInboxQueue(baseDir: str, httpPrefix: str,
if isinstance(postJsonObject['object']['content'], str): if isinstance(postJsonObject['object']['content'], str):
if isFiltered(baseDir, nickname, domain, if isFiltered(baseDir, nickname, domain,
postJsonObject['object']['content']): postJsonObject['object']['content']):
if debug:
print('WARN: post was filtered out due to content') print('WARN: post was filtered out due to content')
return None return None
originalPostId = None originalPostId = None
@ -1376,7 +1377,7 @@ def _receiveAnnounce(recentPostsCache: {},
__version__, translate, __version__, translate,
YTReplacementDomain, YTReplacementDomain,
allowLocalNetworkAccess, allowLocalNetworkAccess,
recentPostsCache) recentPostsCache, debug)
if not postJsonObject: if not postJsonObject:
notInOnion = True notInOnion = True
if onionDomain: if onionDomain:
@ -2465,7 +2466,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
nickname, domain, postJsonObject, nickname, domain, postJsonObject,
translate, YTReplacementDomain, translate, YTReplacementDomain,
allowLocalNetworkAccess, allowLocalNetworkAccess,
recentPostsCache): recentPostsCache, debug):
# media index will be updated # media index will be updated
updateIndexList.append('tlmedia') updateIndexList.append('tlmedia')
if isBlogPost(postJsonObject): if isBlogPost(postJsonObject):

View File

@ -272,7 +272,7 @@ def postMessageToOutbox(session, translate: {},
messageJson, messageJson,
translate, YTReplacementDomain, translate, YTReplacementDomain,
allowLocalNetworkAccess, allowLocalNetworkAccess,
recentPostsCache): recentPostsCache, debug):
inboxUpdateIndex('tlmedia', baseDir, inboxUpdateIndex('tlmedia', baseDir,
postToNickname + '@' + domain, postToNickname + '@' + domain,
savedFilename, debug) savedFilename, debug)

View File

@ -2927,7 +2927,7 @@ def isImageMedia(session, baseDir: str, httpPrefix: str,
postJsonObject: {}, translate: {}, postJsonObject: {}, translate: {},
YTReplacementDomain: str, YTReplacementDomain: str,
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
recentPostsCache: {}) -> bool: recentPostsCache: {}, debug: bool) -> bool:
"""Returns true if the given post has attached image media """Returns true if the given post has attached image media
""" """
if postJsonObject['type'] == 'Announce': if postJsonObject['type'] == 'Announce':
@ -2937,7 +2937,7 @@ def isImageMedia(session, baseDir: str, httpPrefix: str,
__version__, translate, __version__, translate,
YTReplacementDomain, YTReplacementDomain,
allowLocalNetworkAccess, allowLocalNetworkAccess,
recentPostsCache) recentPostsCache, debug)
if postJsonAnnounce: if postJsonAnnounce:
postJsonObject = postJsonAnnounce postJsonObject = postJsonAnnounce
if postJsonObject['type'] != 'Create': if postJsonObject['type'] != 'Create':
@ -3842,7 +3842,7 @@ def downloadAnnounce(session, baseDir: str, httpPrefix: str,
postJsonObject: {}, projectVersion: str, postJsonObject: {}, projectVersion: str,
translate: {}, YTReplacementDomain: str, translate: {}, YTReplacementDomain: str,
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
recentPostsCache: {}) -> {}: recentPostsCache: {}, debug: bool) -> {}:
"""Download the post referenced by an announce """Download the post referenced by an announce
""" """
if not postJsonObject.get('object'): if not postJsonObject.get('object'):
@ -3866,6 +3866,7 @@ def downloadAnnounce(session, baseDir: str, httpPrefix: str,
return None return None
if os.path.isfile(announceFilename): if os.path.isfile(announceFilename):
if debug:
print('Reading cached Announce content for ' + print('Reading cached Announce content for ' +
postJsonObject['object']) postJsonObject['object'])
postJsonObject = loadJson(announceFilename) postJsonObject = loadJson(announceFilename)

View File

@ -1292,7 +1292,7 @@ def individualPostAsHtml(allowDownloads: bool,
projectVersion, translate, projectVersion, translate,
YTReplacementDomain, YTReplacementDomain,
allowLocalNetworkAccess, allowLocalNetworkAccess,
recentPostsCache) recentPostsCache, False)
if not postJsonAnnounce: if not postJsonAnnounce:
# if the announce could not be downloaded then mark it as rejected # if the announce could not be downloaded then mark it as rejected
rejectPostId(baseDir, nickname, domain, postJsonObject['id'], rejectPostId(baseDir, nickname, domain, postJsonObject['id'],