Less verbose when not in debug

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

View File

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

View File

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

View File

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