Debug for mentions extraction

master
Bob Mottram 2019-08-19 10:11:25 +01:00
parent f71dabcbb0
commit f5d1bfeb47
2 changed files with 11 additions and 4 deletions

View File

@ -1849,7 +1849,9 @@ class PubServer(BaseHTTPRequestHandler):
self.server.httpPrefix, \ self.server.httpPrefix, \
fields['message'],True,False,False, \ fields['message'],True,False,False, \
filename,fields['imageDescription'],True, \ filename,fields['imageDescription'],True, \
fields['replyTo'],fields['replyTo'],fields['subject']) fields['replyTo'],fields['replyTo'], \
fields['subject'], \
self.server.debug)
if messageJson: if messageJson:
self.postToNickname=nickname self.postToNickname=nickname
if self.server.debug: if self.server.debug:

View File

@ -761,7 +761,8 @@ def createFollowersOnlyPost(baseDir: str,
attachImageFilename,imageDescription,useBlurhash, \ attachImageFilename,imageDescription,useBlurhash, \
False,inReplyTo, inReplyToAtomUri, subject) False,inReplyTo, inReplyToAtomUri, subject)
def getMentionedPeople(baseDir: str,httpPrefix: str,content: str,domain: str) -> []: def getMentionedPeople(baseDir: str,httpPrefix: str, \
content: str,domain: str,debug: bool) -> []:
"""Extracts a list of mentioned actors from the given message content """Extracts a list of mentioned actors from the given message content
""" """
if '@' not in content: if '@' not in content:
@ -771,6 +772,8 @@ def getMentionedPeople(baseDir: str,httpPrefix: str,content: str,domain: str) ->
for wrd in words: for wrd in words:
if wrd.startswith('@'): if wrd.startswith('@'):
handle=wrd[1:] handle=wrd[1:]
if debug:
print('DEBUG: mentioned handle '+handle)
if '@' not in handle: if '@' not in handle:
handle=handle+'@'+domain handle=handle+'@'+domain
if not os.path.isdir(baseDir+'/accounts/'+handle): if not os.path.isdir(baseDir+'/accounts/'+handle):
@ -791,10 +794,12 @@ def createDirectMessagePost(baseDir: str,
content: str, followersOnly: bool, saveToFile: bool, content: str, followersOnly: bool, saveToFile: bool,
clientToServer: bool,\ clientToServer: bool,\
attachImageFilename: str,imageDescription: str,useBlurhash: bool, \ attachImageFilename: str,imageDescription: str,useBlurhash: bool, \
inReplyTo=None, inReplyToAtomUri=None, subject=None) -> {}: inReplyTo=None, inReplyToAtomUri=None, subject=None,debug=False) -> {}:
"""Direct Message post """Direct Message post
""" """
mentionedPeople=getMentionedPeople(baseDir,httpPrefix,content,domain) mentionedPeople=getMentionedPeople(baseDir,httpPrefix,content,domain,debug)
if debug:
print('mentionedPeople: '+str(mentionedPeople))
postTo=None postTo=None
postCc=None postCc=None
if not mentionedPeople: if not mentionedPeople: