From aaa71b542e35fe0a6acabba89c31067183b22b26 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 27 Jun 2021 20:33:07 +0100 Subject: [PATCH] Function for git projects section of edit profile screen --- webapp_profile.py | 48 +++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/webapp_profile.py b/webapp_profile.py index fb5992eb3..8d6b46c22 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -1386,6 +1386,33 @@ def _htmlEditProfileSkills(baseDir: str, nickname: str, domain: str, return editProfileForm +def _htmlEditProfileGitProjects(baseDir: str, nickname: str, domain: str, + translate: {}) -> str: + """git projects section of edit profile screen + """ + gitProjectsStr = '' + gitProjectsFilename = \ + baseDir + '/accounts/' + \ + nickname + '@' + domain + '/gitprojects.txt' + if os.path.isfile(gitProjectsFilename): + with open(gitProjectsFilename, 'r') as gitProjectsFile: + gitProjectsStr = gitProjectsFile.read() + + editProfileForm = '
' + \ + translate['Git Projects'] + '\n' + editProfileForm += '
\n' + idx = 'List of project names that you wish to receive git patches for' + editProfileForm += \ + ' \n' + editProfileForm += \ + ' \n' + editProfileForm += '
\n' + return editProfileForm + + def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str, domain: str, port: int, httpPrefix: str, defaultTimeline: str, theme: str, @@ -1542,14 +1569,6 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str, with open(allowedInstancesFilename, 'r') as allowedInstancesFile: allowedInstancesStr = allowedInstancesFile.read() - gitProjectsStr = '' - gitProjectsFilename = \ - baseDir + '/accounts/' + \ - nickname + '@' + domain + '/gitprojects.txt' - if os.path.isfile(gitProjectsFilename): - with open(gitProjectsFilename, 'r') as gitProjectsFile: - gitProjectsStr = gitProjectsFile.read() - cssFilename = baseDir + '/epicyon-profile.css' if os.path.isfile(baseDir + '/epicyon.css'): cssFilename = baseDir + '/epicyon.css' @@ -1951,19 +1970,8 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str, editProfileForm += ' \n' # git projects section - editProfileForm += '
' + \ - translate['Git Projects'] + '\n' - editProfileForm += '
\n' - idx = 'List of project names that you wish to receive git patches for' editProfileForm += \ - ' \n' - editProfileForm += \ - ' \n' - - editProfileForm += '
\n' + _htmlEditProfileGitProjects(baseDir, nickname, domain, translate) # Skills section editProfileForm += \