From 501feef6164d9a3e6ff5f3a12b3fef913c372f22 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 27 Dec 2021 15:43:22 +0000 Subject: [PATCH] Snake case --- blog.py | 4 ++-- content.py | 6 +++--- daemon.py | 8 ++++---- desktop_client.py | 6 +++--- inbox.py | 6 +++--- languages.py | 6 +++--- newsdaemon.py | 4 ++-- newswire.py | 38 +++++++++++++++++++------------------- person.py | 8 ++++---- posts.py | 6 +++--- speaker.py | 6 +++--- tests.py | 20 ++++++++++---------- utils.py | 6 +++--- webapp_column_right.py | 6 +++--- webapp_person_options.py | 30 +++++++++++++++--------------- webapp_post.py | 6 +++--- webapp_profile.py | 4 ++-- webapp_utils.py | 10 +++++----- webapp_welcome.py | 4 ++-- webapp_welcome_final.py | 4 ++-- webapp_welcome_profile.py | 4 ++-- 21 files changed, 96 insertions(+), 96 deletions(-) diff --git a/blog.py b/blog.py index 4f2dba466..4fd04ee01 100644 --- a/blog.py +++ b/blog.py @@ -22,7 +22,7 @@ from utils import get_actor_languages_list from utils import get_base_content_from_post from utils import get_content_from_post from utils import is_account_dir -from utils import removeHtml +from utils import remove_html from utils import get_config_param from utils import get_full_domain from utils import getMediaFormats @@ -434,7 +434,7 @@ def _getSnippetFromBlogContent(post_json_object: {}, content = content.split('

', 1)[1] if '

' in content: content = content.split('

', 1)[0] - content = removeHtml(content) + content = remove_html(content) if '\n' in content: content = content.split('\n')[0] if len(content) >= 256: diff --git a/content.py b/content.py index 7bb8b5c5a..43212eed1 100644 --- a/content.py +++ b/content.py @@ -25,12 +25,12 @@ from utils import contains_pgp_public_key from utils import acct_dir from utils import is_float from utils import get_currencies -from utils import removeHtml +from utils import remove_html from petnames import getPetName from session import downloadImage -def removeHtmlTag(htmlStr: str, tag: str) -> str: +def remove_htmlTag(htmlStr: str, tag: str) -> str: """Removes a given tag from a html string """ tagFound = True @@ -1253,7 +1253,7 @@ def _wordsSimilarityWordsList(content: str) -> []: """Returns a list of words for the given content """ removePunctuation = ('.', ',', ';', '-', ':', '"') - content = removeHtml(content).lower() + content = remove_html(content).lower() for p in removePunctuation: content = content.replace(p, ' ') content = content.replace(' ', ' ') diff --git a/daemon.py b/daemon.py index 1f61d56b3..ee7027778 100644 --- a/daemon.py +++ b/daemon.py @@ -273,7 +273,7 @@ from utils import isPublicPost from utils import get_locked_account from utils import has_users_path from utils import get_full_domain -from utils import removeHtml +from utils import remove_html from utils import is_editor from utils import is_artist from utils import get_image_extensions @@ -4998,7 +4998,7 @@ class PubServer(BaseHTTPRequestHandler): if fields.get('displayNickname'): if fields['displayNickname'] != actor_json['name']: displayName = \ - removeHtml(fields['displayNickname']) + remove_html(fields['displayNickname']) if not isFiltered(base_dir, nickname, domain, displayName): @@ -5477,7 +5477,7 @@ class PubServer(BaseHTTPRequestHandler): occupationName = get_occupation_name(actor_json) if fields.get('occupationName'): fields['occupationName'] = \ - removeHtml(fields['occupationName']) + remove_html(fields['occupationName']) if occupationName != \ fields['occupationName']: set_occupation_name(actor_json, @@ -5524,7 +5524,7 @@ class PubServer(BaseHTTPRequestHandler): # change user bio if fields.get('bio'): if fields['bio'] != actor_json['summary']: - bioStr = removeHtml(fields['bio']) + bioStr = remove_html(fields['bio']) if not isFiltered(base_dir, nickname, domain, bioStr): actorTags = {} diff --git a/desktop_client.py b/desktop_client.py index c24a17dd9..c0fc951e9 100644 --- a/desktop_client.py +++ b/desktop_client.py @@ -21,7 +21,7 @@ from utils import has_object_dict from utils import get_full_domain from utils import is_dm from utils import load_translations_from_file -from utils import removeHtml +from utils import remove_html from utils import getNicknameFromActor from utils import getDomainFromActor from utils import is_pgp_encrypted @@ -586,7 +586,7 @@ def _textOnlyContent(content: str) -> str: """ content = urllib.parse.unquote_plus(content) content = html.unescape(content) - return removeHtml(content) + return remove_html(content) def _getImageDescription(post_json_object: {}) -> str: @@ -827,7 +827,7 @@ def _desktopShowActor(base_dir: str, actor_json: {}, translate: {}, sayStr = 'Also known as ' + html.unescape(alsoKnownAsStr) _sayCommand(sayStr, sayStr, screenreader, system_language, espeak) if actor_json.get('summary'): - sayStr = html.unescape(removeHtml(actor_json['summary'])) + sayStr = html.unescape(remove_html(actor_json['summary'])) sayStr = sayStr.replace('"', "'") sayStr2 = speakableText(base_dir, sayStr, translate)[0] _sayCommand(sayStr, sayStr2, screenreader, system_language, espeak) diff --git a/inbox.py b/inbox.py index c5f5d636c..bb36291a1 100644 --- a/inbox.py +++ b/inbox.py @@ -21,7 +21,7 @@ from utils import domainPermitted from utils import is_group_account from utils import is_system_account from utils import invalid_ciphertext -from utils import removeHtml +from utils import remove_html from utils import fileLastModified from utils import has_object_string from utils import has_object_string_object @@ -1290,7 +1290,7 @@ def _receiveReaction(recent_posts_cache: {}, handleDom = handle.split('@')[1] postReactionId = message_json['object'] - emojiContent = removeHtml(message_json['content']) + emojiContent = remove_html(message_json['content']) if not emojiContent: if debug: print('DEBUG: emoji reaction has no content') @@ -1441,7 +1441,7 @@ def _receiveUndoReaction(recent_posts_cache: {}, print('DEBUG: reaction post found in inbox. Now undoing.') reactionActor = message_json['actor'] postReactionId = message_json['object'] - emojiContent = removeHtml(message_json['object']['content']) + emojiContent = remove_html(message_json['object']['content']) if not emojiContent: if debug: print('DEBUG: unreaction has no content') diff --git a/languages.py b/languages.py index 918f364f8..935b3c2bc 100644 --- a/languages.py +++ b/languages.py @@ -11,7 +11,7 @@ import os import json from urllib import request, parse from utils import get_actor_languages_list -from utils import removeHtml +from utils import remove_html from utils import has_object_dict from utils import get_config_param from utils import local_actor_url @@ -240,7 +240,7 @@ def libretranslate(url: str, text: str, links = getLinksFromContent(text) # LibreTranslate doesn't like markup - text = removeHtml(text) + text = remove_html(text) # remove any links from plain text version of the content for _, url in links.items(): @@ -302,7 +302,7 @@ def autoTranslatePost(base_dir: str, post_json_object: {}, lang, system_language, libretranslateApiKey) if translatedText: - if removeHtml(translatedText) == removeHtml(content): + if remove_html(translatedText) == remove_html(content): return content translatedText = \ '

' + translate['Translated'].upper() + '

' + \ diff --git a/newsdaemon.py b/newsdaemon.py index 74c8fe885..0fa7ac612 100644 --- a/newsdaemon.py +++ b/newsdaemon.py @@ -26,7 +26,7 @@ from posts import createNewsPost from posts import archivePostsForPerson from content import validHashTag from utils import get_base_content_from_post -from utils import removeHtml +from utils import remove_html from utils import get_full_domain from utils import load_json from utils import save_json @@ -605,7 +605,7 @@ def _convertRSStoActivityPub(base_dir: str, http_prefix: str, rssDescription = '' # get the rss description if it exists - rssDescription = '

' + removeHtml(item[4]) + '

' + rssDescription = '

' + remove_html(item[4]) + '

' mirrored = item[7] postUrl = url diff --git a/newswire.py b/newswire.py index baea8d339..b505f7588 100644 --- a/newswire.py +++ b/newswire.py @@ -29,7 +29,7 @@ from utils import load_json from utils import save_json from utils import is_suspended from utils import containsInvalidChars -from utils import removeHtml +from utils import remove_html from utils import is_account_dir from utils import acct_dir from utils import local_actor_url @@ -208,8 +208,8 @@ def _addNewswireDictEntry(base_dir: str, domain: str, """Update the newswire dictionary """ # remove any markup - title = removeHtml(title) - description = removeHtml(description) + title = remove_html(title) + description = remove_html(description) allText = title + ' ' + description @@ -419,17 +419,17 @@ def _xml2StrToDict(base_dir: str, domain: str, xmlStr: str, continue title = rssItem.split('')[1] title = _removeCDATA(title.split('')[0]) - title = removeHtml(title) + title = remove_html(title) description = '' if '' in rssItem and '' in rssItem: description = rssItem.split('')[1] - description = removeHtml(description.split('')[0]) + description = remove_html(description.split('')[0]) else: if '' in rssItem and \ '' in rssItem: description = rssItem.split('')[1] description = description.split('')[0] - description = removeHtml(description) + description = remove_html(description) link = rssItem.split('')[1] link = link.split('')[0] if '://' not in link: @@ -507,17 +507,17 @@ def _xml1StrToDict(base_dir: str, domain: str, xmlStr: str, continue title = rssItem.split('')[1] title = _removeCDATA(title.split('')[0]) - title = removeHtml(title) + title = remove_html(title) description = '' if '' in rssItem and '' in rssItem: description = rssItem.split('')[1] - description = removeHtml(description.split('')[0]) + description = remove_html(description.split('')[0]) else: if '' in rssItem and \ '' in rssItem: description = rssItem.split('')[1] description = description.split('')[0] - description = removeHtml(description) + description = remove_html(description) link = rssItem.split('')[1] link = link.split('')[0] if '://' not in link: @@ -583,17 +583,17 @@ def _atomFeedToDict(base_dir: str, domain: str, xmlStr: str, continue title = atomItem.split('')[1] title = _removeCDATA(title.split('')[0]) - title = removeHtml(title) + title = remove_html(title) description = '' if '

' in atomItem and '' in atomItem: description = atomItem.split('')[1] - description = removeHtml(description.split('')[0]) + description = remove_html(description.split('')[0]) else: if '' in atomItem and \ '' in atomItem: description = atomItem.split('')[1] description = description.split('')[0] - description = removeHtml(description) + description = remove_html(description) link = atomItem.split('')[1] link = link.split('')[0] if '://' not in link: @@ -670,11 +670,11 @@ def _jsonFeedV1ToDict(base_dir: str, domain: str, xmlStr: str, if jsonFeedItem.get('content_html'): if not isinstance(jsonFeedItem['content_html'], str): continue - title = removeHtml(jsonFeedItem['content_html']) + title = remove_html(jsonFeedItem['content_html']) else: if not isinstance(jsonFeedItem['content_text'], str): continue - title = removeHtml(jsonFeedItem['content_text']) + title = remove_html(jsonFeedItem['content_text']) if len(title) > maxBytes: print('WARN: json feed title is too long') continue @@ -682,7 +682,7 @@ def _jsonFeedV1ToDict(base_dir: str, domain: str, xmlStr: str, if jsonFeedItem.get('description'): if not isinstance(jsonFeedItem['description'], str): continue - description = removeHtml(jsonFeedItem['description']) + description = remove_html(jsonFeedItem['description']) if len(description) > maxBytes: print('WARN: json feed description is too long') continue @@ -780,11 +780,11 @@ def _atomFeedYTToDict(base_dir: str, domain: str, xmlStr: str, '' in atomItem: description = atomItem.split('')[1] description = description.split('')[0] - description = removeHtml(description) + description = remove_html(description) elif '' in atomItem and '' in atomItem: description = atomItem.split('')[1] description = description.split('')[0] - description = removeHtml(description) + description = remove_html(description) link = atomItem.split('')[1] link = link.split('')[0] link = 'https://www.youtube.com/watch?v=' + link.strip() @@ -946,7 +946,7 @@ def getRSSfromDict(base_dir: str, newswire: {}, rssStr += \ '\n' + \ ' ' + fields[0] + '\n' - description = removeHtml(firstParagraphFromString(fields[4])) + description = remove_html(firstParagraphFromString(fields[4])) rssStr += ' ' + description + '\n' url = fields[1] if '://' not in url: @@ -1065,7 +1065,7 @@ def _addAccountBlogsToNewswire(base_dir: str, nickname: str, domain: str, get_base_content_from_post(post_json_object, system_language) description = firstParagraphFromString(content) - description = removeHtml(description) + description = remove_html(description) tagsFromPost = _getHashtagsFromPost(post_json_object) summary = post_json_object['object']['summary'] _addNewswireDictEntry(base_dir, domain, diff --git a/person.py b/person.py index 479f51c56..61852b3e1 100644 --- a/person.py +++ b/person.py @@ -38,7 +38,7 @@ from roles import setRole from roles import setRolesFromList from roles import getActorRolesList from media import processMetaData -from utils import removeHtml +from utils import remove_html from utils import containsInvalidChars from utils import replace_users_with_at from utils import remove_line_endings @@ -1696,7 +1696,7 @@ def validSendingActor(session, base_dir: str, if not unit_test: bioStr = '' if actor_json.get('summary'): - bioStr = removeHtml(actor_json['summary']).strip() + bioStr = remove_html(actor_json['summary']).strip() if not bioStr: # allow no bio if it's an actor in this instance if domain not in sendingActor: @@ -1707,7 +1707,7 @@ def validSendingActor(session, base_dir: str, print('REJECT: actor bio is not long enough ' + sendingActor + ' ' + bioStr) return False - bioStr += ' ' + removeHtml(actor_json['preferredUsername']) + bioStr += ' ' + remove_html(actor_json['preferredUsername']) if actor_json.get('attachment'): if isinstance(actor_json['attachment'], list): @@ -1724,7 +1724,7 @@ def validSendingActor(session, base_dir: str, bioStr += ' ' + tag['value'] if actor_json.get('name'): - bioStr += ' ' + removeHtml(actor_json['name']) + bioStr += ' ' + remove_html(actor_json['name']) if containsInvalidChars(bioStr): print('REJECT: post actor bio contains invalid characters') return False diff --git a/posts.py b/posts.py index 91854e4d4..00a3c2756 100644 --- a/posts.py +++ b/posts.py @@ -65,7 +65,7 @@ from utils import get_config_param from utils import locateNewsVotes from utils import locateNewsArrival from utils import votesOnNewswireItem -from utils import removeHtml +from utils import remove_html from utils import dangerousMarkup from utils import acct_dir from utils import local_actor_url @@ -714,7 +714,7 @@ def _updateWordFrequency(content: str, wordFrequency: {}) -> None: """Creates a dictionary containing words and the number of times that they appear """ - plainText = removeHtml(content) + plainText = remove_html(content) removeChars = ('.', ';', '?', '\n', ':') for ch in removeChars: plainText = plainText.replace(ch, ' ') @@ -997,7 +997,7 @@ def _addSchedulePost(base_dir: str, nickname: str, domain: str, def validContentWarning(cw: str) -> str: """Returns a validated content warning """ - cw = removeHtml(cw) + cw = remove_html(cw) # hashtags within content warnings apparently cause a lot of trouble # so remove them if '#' in cw: diff --git a/speaker.py b/speaker.py index 4145b376f..8576dd2c9 100644 --- a/speaker.py +++ b/speaker.py @@ -19,7 +19,7 @@ from utils import getDomainFromActor from utils import getNicknameFromActor from utils import getGenderFromBio from utils import getDisplayName -from utils import removeHtml +from utils import remove_html from utils import load_json from utils import save_json from utils import is_pgp_encrypted @@ -388,7 +388,7 @@ def speakableText(base_dir: str, content: str, translate: {}) -> (str, []): # replace some emoji before removing html if ' <3' in content: content = content.replace(' <3', ' ' + translate['heart']) - content = removeHtml(htmlReplaceQuoteMarks(content)) + content = remove_html(htmlReplaceQuoteMarks(content)) detectedLinks = [] content = speakerReplaceLinks(content, translate, detectedLinks) # replace all double spaces @@ -426,7 +426,7 @@ def _postToSpeakerJson(base_dir: str, http_prefix: str, # replace some emoji before removing html if ' <3' in content: content = content.replace(' <3', ' ' + translate['heart']) - content = removeHtml(htmlReplaceQuoteMarks(content)) + content = remove_html(htmlReplaceQuoteMarks(content)) content = speakerReplaceLinks(content, translate, detectedLinks) # replace all double spaces while ' ' in content: diff --git a/tests.py b/tests.py index 36bf4c4bd..c272f6212 100644 --- a/tests.py +++ b/tests.py @@ -82,7 +82,7 @@ from utils import load_json from utils import save_json from utils import getStatusNumber from utils import get_followers_of_person -from utils import removeHtml +from utils import remove_html from utils import dangerousMarkup from utils import acct_dir from pgp import extractPGPPublicKey @@ -141,7 +141,7 @@ from content import addHtmlTags from content import removeLongWords from content import replaceContentDuplicates from content import removeTextFormatting -from content import removeHtmlTag +from content import remove_htmlTag from theme import updateDefaultThemesList from theme import setCSSparam from theme import scanThemesForScripts @@ -3655,17 +3655,17 @@ def _testSiteIsActive(): def _testRemoveHtml(): print('testRemoveHtml') testStr = 'This string has no html.' - assert(removeHtml(testStr) == testStr) + assert(remove_html(testStr) == testStr) testStr = 'This string has html.' - assert(removeHtml(testStr) == 'This string has html.') + assert(remove_html(testStr) == 'This string has html.') testStr = '' - assert(removeHtml(testStr) == 'This string has. Two labels.') + assert(remove_html(testStr) == 'This string has. Two labels.') testStr = '

This string has.

Two paragraphs.

' - assert(removeHtml(testStr) == 'This string has.\n\nTwo paragraphs.') + assert(remove_html(testStr) == 'This string has.\n\nTwo paragraphs.') testStr = 'This string has.
A new line.' - assert(removeHtml(testStr) == 'This string has.\nA new line.') + assert(remove_html(testStr) == 'This string has.\nA new line.') testStr = '

This string contains a url http://somesite.or.other

' - assert(removeHtml(testStr) == + assert(remove_html(testStr) == 'This string contains a url http://somesite.or.other') @@ -3998,7 +3998,7 @@ def _testRemoveHtmlTag(): print('testRemoveHtmlTag') testStr = "

" - resultStr = removeHtmlTag(testStr, 'width') + resultStr = remove_htmlTag(testStr, 'width') assert resultStr == "

" @@ -5622,7 +5622,7 @@ def _testGetLinksFromContent(): assert links.get('another') assert links['another'] == link2 - contentPlain = '

' + removeHtml(content) + '

' + contentPlain = '

' + remove_html(content) + '

' assert '>@linked' not in contentPlain content = addLinksToContent(contentPlain, links) assert '>@linked' in content diff --git a/utils.py b/utils.py index d89fbae92..5b8f4ab27 100644 --- a/utils.py +++ b/utils.py @@ -440,7 +440,7 @@ def getMediaFormats() -> str: return mediaFormats -def removeHtml(content: str) -> str: +def remove_html(content: str) -> str: """Removes html links from the given content. Used to ensure that profile descriptions don't contain dubious content """ @@ -479,11 +479,11 @@ def firstParagraphFromString(content: str) -> str: to be used as a summary in the newswire feed """ if '

' not in content or '

' not in content: - return removeHtml(content) + return remove_html(content) paragraph = content.split('

')[1] if '

' in paragraph: paragraph = paragraph.split('

')[0] - return removeHtml(paragraph) + return remove_html(paragraph) def is_system_account(nickname: str) -> bool: diff --git a/webapp_column_right.py b/webapp_column_right.py index ad7c170e5..3c77e2f03 100644 --- a/webapp_column_right.py +++ b/webapp_column_right.py @@ -13,7 +13,7 @@ from content import removeLongWords from content import limitRepeatedWords from utils import get_fav_filename_from_url from utils import get_base_content_from_post -from utils import removeHtml +from utils import remove_html from utils import locate_post from utils import load_json from utils import votesOnNewswireItem @@ -221,7 +221,7 @@ def _htmlNewswire(base_dir: str, newswire: {}, nickname: str, moderator: bool, separatorStr = htmlPostSeparator(base_dir, 'right') htmlStr = '' for dateStr, item in newswire.items(): - item[0] = removeHtml(item[0]).strip() + item[0] = remove_html(item[0]).strip() if not item[0]: continue # remove any CDATA @@ -408,7 +408,7 @@ def htmlCitations(base_dir: str, nickname: str, domain: str, if newswire: ctr = 0 for dateStr, item in newswire.items(): - item[0] = removeHtml(item[0]).strip() + item[0] = remove_html(item[0]).strip() if not item[0]: continue # remove any CDATA diff --git a/webapp_person_options.py b/webapp_person_options.py index 84646af1f..8c7eec9a4 100644 --- a/webapp_person_options.py +++ b/webapp_person_options.py @@ -15,7 +15,7 @@ from posts import isModerator from utils import get_full_domain from utils import get_config_param from utils import is_dormant -from utils import removeHtml +from utils import remove_html from utils import getDomainFromActor from utils import getNicknameFromActor from utils import is_featured_writer @@ -191,51 +191,51 @@ def htmlPersonOptions(defaultTimeline: str, optionsStr += \ '

' + translate['Email'] + \ ': ' + removeHtml(emailAddress) + '

\n' + emailAddress + '">' + remove_html(emailAddress) + '

\n' if xmppAddress: optionsStr += \ '

' + translate['XMPP'] + \ - ': ' + \ + ': ' + \ xmppAddress + '

\n' if matrixAddress: optionsStr += \ '

' + translate['Matrix'] + ': ' + \ - removeHtml(matrixAddress) + '

\n' + remove_html(matrixAddress) + '

\n' if ssbAddress: optionsStr += \ - '

SSB: ' + removeHtml(ssbAddress) + '

\n' + '

SSB: ' + remove_html(ssbAddress) + '

\n' if blogAddress: optionsStr += \ '

Blog: ' + \ - removeHtml(blogAddress) + '

\n' + remove_html(blogAddress) + '">' + \ + remove_html(blogAddress) + '

\n' if toxAddress: optionsStr += \ - '

Tox: ' + removeHtml(toxAddress) + '

\n' + '

Tox: ' + remove_html(toxAddress) + '

\n' if briarAddress: if briarAddress.startswith('briar://'): optionsStr += \ '

' + \ - removeHtml(briarAddress) + '

\n' + remove_html(briarAddress) + '

\n' else: optionsStr += \ '

briar://' + \ - removeHtml(briarAddress) + '

\n' + remove_html(briarAddress) + '

\n' if jamiAddress: optionsStr += \ - '

Jami: ' + removeHtml(jamiAddress) + '

\n' + '

Jami: ' + remove_html(jamiAddress) + '

\n' if cwtchAddress: optionsStr += \ - '

Cwtch: ' + removeHtml(cwtchAddress) + '

\n' + '

Cwtch: ' + remove_html(cwtchAddress) + '

\n' if EnigmaPubKey: optionsStr += \ - '

Enigma: ' + removeHtml(EnigmaPubKey) + '

\n' + '

Enigma: ' + remove_html(EnigmaPubKey) + '

\n' if PGPfingerprint: optionsStr += '

PGP: ' + \ - removeHtml(PGPfingerprint).replace('\n', '
') + '

\n' + remove_html(PGPfingerprint).replace('\n', '
') + '

\n' if PGPpubKey: optionsStr += '

' + \ - removeHtml(PGPpubKey).replace('\n', '
') + '

\n' + remove_html(PGPpubKey).replace('\n', '
') + '

\n' optionsStr += '
\n' optionsStr += ' \n" if not objJson.get('attachment') or objJson.get('sensitive'): if objJson.get('content') and not objJson.get('sensitive'): - description = removeHtml(objJson['content']) + description = remove_html(objJson['content']) metadata += \ " \n" @@ -142,7 +142,7 @@ def _htmlPostMetadataOpenGraph(domain: str, post_json_object: {}) -> str: description = 'Attached: 1 audio' if description: if objJson.get('content') and not objJson.get('sensitive'): - description += '\n\n' + removeHtml(objJson['content']) + description += '\n\n' + remove_html(objJson['content']) metadata += \ " \n" diff --git a/webapp_profile.py b/webapp_profile.py index 3e984e418..dd972d719 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -21,7 +21,7 @@ from utils import is_dormant from utils import getNicknameFromActor from utils import getDomainFromActor from utils import is_system_account -from utils import removeHtml +from utils import remove_html from utils import load_json from utils import get_config_param from utils import get_image_formats @@ -242,7 +242,7 @@ def htmlProfileAfterSearch(cssCache: {}, avatarDescription = avatarDescription.replace('

', '') avatarDescription = avatarDescription.replace('

', '') if '<' in avatarDescription: - avatarDescription = removeHtml(avatarDescription) + avatarDescription = remove_html(avatarDescription) imageUrl = '' if profile_json.get('image'): diff --git a/webapp_utils.py b/webapp_utils.py index eae68c9df..1acf630b0 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -12,7 +12,7 @@ from shutil import copyfile from collections import OrderedDict from session import getJson from utils import is_account_dir -from utils import removeHtml +from utils import remove_html from utils import getProtocolPrefixes from utils import load_json from utils import get_cached_post_filename @@ -230,7 +230,7 @@ def _setActorPropertyUrl(actor_json: {}, property_name: str, url: str) -> None: def setBlogAddress(actor_json: {}, blogAddress: str) -> None: """Sets an blog address for the given actor """ - _setActorPropertyUrl(actor_json, 'Blog', removeHtml(blogAddress)) + _setActorPropertyUrl(actor_json, 'Blog', remove_html(blogAddress)) def updateAvatarImageCache(signing_priv_key_pem: str, @@ -650,8 +650,8 @@ def htmlHeaderWithPersonMarkup(cssFilename: str, instanceTitle: str, firstEntry = False skillsMarkup += '\n ],\n' - description = removeHtml(actor_json['summary']) - nameStr = removeHtml(actor_json['name']) + description = remove_html(actor_json['summary']) + nameStr = remove_html(actor_json['name']) domain_full = actor_json['id'].split('://')[1].split('/')[0] handle = actor_json['preferredUsername'] + '@' + domain_full @@ -689,7 +689,7 @@ def htmlHeaderWithPersonMarkup(cssFilename: str, instanceTitle: str, ' }\n' + \ ' \n' - description = removeHtml(description) + description = remove_html(description) ogMetadata = \ " \n" + \ "