From d466b83df03d0eb3151992f0645011fd3d97b056 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 28 Nov 2020 10:49:10 +0000 Subject: [PATCH] Tidying --- daemon.py | 4 ++-- webapp.py | 56 ------------------------------------------------- webapp_utils.py | 45 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 58 deletions(-) delete mode 100644 webapp.py diff --git a/daemon.py b/daemon.py index 7f914d1f7..73e14b005 100644 --- a/daemon.py +++ b/daemon.py @@ -113,13 +113,14 @@ from blog import htmlBlogView from blog import htmlBlogPage from blog import htmlBlogPost from blog import htmlEditBlog +from webapp_utils import htmlHashtagBlocked +from webapp_utils import htmlFollowingList from webapp_utils import setBlogAddress from webapp_utils import getBlogAddress from webapp_calendar import htmlCalendarDeleteConfirm from webapp_calendar import htmlCalendar from webapp_about import htmlAbout from webapp_confirm import htmlConfirmDelete -from webapp import htmlFollowingList from webapp_confirm import htmlConfirmRemoveSharedItem from webapp_confirm import htmlConfirmUnblock from webapp_person_options import htmlPersonOptions @@ -143,7 +144,6 @@ from webapp_suspended import htmlSuspended from webapp_tos import htmlTermsOfService from webapp_confirm import htmlConfirmFollow from webapp_confirm import htmlConfirmUnfollow -from webapp import htmlHashtagBlocked from webapp_post import htmlPostReplies from webapp_post import htmlIndividualPost from webapp_profile import htmlEditProfile diff --git a/webapp.py b/webapp.py deleted file mode 100644 index e0e8bdaef..000000000 --- a/webapp.py +++ /dev/null @@ -1,56 +0,0 @@ -__filename__ = "webapp.py" -__author__ = "Bob Mottram" -__license__ = "AGPL3+" -__version__ = "1.1.0" -__maintainer__ = "Bob Mottram" -__email__ = "bob@freedombone.net" -__status__ = "Production" - -import os -from webapp_utils import htmlHeaderWithExternalStyle -from webapp_utils import htmlFooter - - -def htmlFollowingList(cssCache: {}, baseDir: str, - followingFilename: str) -> str: - """Returns a list of handles being followed - """ - with open(followingFilename, 'r') as followingFile: - msg = followingFile.read() - followingList = msg.split('\n') - followingList.sort() - if followingList: - cssFilename = baseDir + '/epicyon-profile.css' - if os.path.isfile(baseDir + '/epicyon.css'): - cssFilename = baseDir + '/epicyon.css' - - followingListHtml = htmlHeaderWithExternalStyle(cssFilename) - for followingAddress in followingList: - if followingAddress: - followingListHtml += \ - '

@' + followingAddress + '

' - followingListHtml += htmlFooter() - msg = followingListHtml - return msg - return '' - - -def htmlHashtagBlocked(cssCache: {}, baseDir: str, translate: {}) -> str: - """Show the screen for a blocked hashtag - """ - blockedHashtagForm = '' - cssFilename = baseDir + '/epicyon-suspended.css' - if os.path.isfile(baseDir + '/suspended.css'): - cssFilename = baseDir + '/suspended.css' - - blockedHashtagForm = htmlHeaderWithExternalStyle(cssFilename) - blockedHashtagForm += '
\n' - blockedHashtagForm += \ - '

' + \ - translate['Hashtag Blocked'] + '

\n' - blockedHashtagForm += \ - '

See ' + \ - translate['Terms of Service'] + '

\n' - blockedHashtagForm += '
\n' - blockedHashtagForm += htmlFooter() - return blockedHashtagForm diff --git a/webapp_utils.py b/webapp_utils.py index e704a83f0..3019d40ff 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -20,6 +20,51 @@ from content import addHtmlTags from content import replaceEmojiFromTags +def htmlFollowingList(cssCache: {}, baseDir: str, + followingFilename: str) -> str: + """Returns a list of handles being followed + """ + with open(followingFilename, 'r') as followingFile: + msg = followingFile.read() + followingList = msg.split('\n') + followingList.sort() + if followingList: + cssFilename = baseDir + '/epicyon-profile.css' + if os.path.isfile(baseDir + '/epicyon.css'): + cssFilename = baseDir + '/epicyon.css' + + followingListHtml = htmlHeaderWithExternalStyle(cssFilename) + for followingAddress in followingList: + if followingAddress: + followingListHtml += \ + '

@' + followingAddress + '

' + followingListHtml += htmlFooter() + msg = followingListHtml + return msg + return '' + + +def htmlHashtagBlocked(cssCache: {}, baseDir: str, translate: {}) -> str: + """Show the screen for a blocked hashtag + """ + blockedHashtagForm = '' + cssFilename = baseDir + '/epicyon-suspended.css' + if os.path.isfile(baseDir + '/suspended.css'): + cssFilename = baseDir + '/suspended.css' + + blockedHashtagForm = htmlHeaderWithExternalStyle(cssFilename) + blockedHashtagForm += '
\n' + blockedHashtagForm += \ + '

' + \ + translate['Hashtag Blocked'] + '

\n' + blockedHashtagForm += \ + '

See ' + \ + translate['Terms of Service'] + '

\n' + blockedHashtagForm += '
\n' + blockedHashtagForm += htmlFooter() + return blockedHashtagForm + + def headerButtonsFrontScreen(translate: {}, nickname: str, boxName: str, authorized: bool,