More debug

main
Bob Mottram 2020-05-02 16:24:17 +00:00
parent a99483b3fc
commit bd39a394dc
1 changed files with 12 additions and 2 deletions

14
git.py
View File

@ -16,16 +16,16 @@ def getGitProjectName(baseDir: str, nickname: str, domain: str,
and should match against a list of projects which the account and should match against a list of projects which the account
holder wants to receive holder wants to receive
""" """
print('Debug git subject ' + subject)
gitProjectsFilename = \ gitProjectsFilename = \
baseDir + '/accounts/' + nickname + '@' + domain + '/gitprojects.txt' baseDir + '/accounts/' + nickname + '@' + domain + '/gitprojects.txt'
if not os.path.isfile(gitProjectsFilename): if not os.path.isfile(gitProjectsFilename):
return None return None
projectName = None
subjectLineWords = subject.lower().split(' ') subjectLineWords = subject.lower().split(' ')
for word in subjectLineWords: for word in subjectLineWords:
if word + '\n' in open(gitProjectsFilename).read(): if word + '\n' in open(gitProjectsFilename).read():
return word return word
return projectName return None
def isGitPatch(baseDir: str, nickname: str, domain: str, def isGitPatch(baseDir: str, nickname: str, domain: str,
@ -33,28 +33,38 @@ def isGitPatch(baseDir: str, nickname: str, domain: str,
"""Is the given post content a git patch? """Is the given post content a git patch?
""" """
# must have a subject line # must have a subject line
print('Debug git 11: ' + content)
if not subject: if not subject:
return False return False
print('Debug git 12')
if '[PATCH]' not in content: if '[PATCH]' not in content:
return False return False
print('Debug git 13')
if '---' not in content: if '---' not in content:
return False return False
print('Debug git 14')
if 'diff ' not in content: if 'diff ' not in content:
return False return False
print('Debug git 15')
if 'From:' not in content: if 'From:' not in content:
return False return False
print('Debug git 16')
if 'Date:' not in content: if 'Date:' not in content:
return False return False
print('Debug git 17')
if 'Subject:' not in content: if 'Subject:' not in content:
return False return False
print('Debug git 18')
if '<br>' not in content: if '<br>' not in content:
if '<br />' not in content: if '<br />' not in content:
return False return False
print('Debug git 19')
projectName = \ projectName = \
getGitProjectName(baseDir, nickname, domain, getGitProjectName(baseDir, nickname, domain,
subject) subject)
if not projectName: if not projectName:
return False return False
print('Debug git 20')
return True return True