Snake case

main
Bob Mottram 2021-12-26 16:01:32 +00:00
parent a16202afbe
commit 7fd45f1fcd
3 changed files with 7 additions and 6 deletions

View File

@ -19,7 +19,7 @@ from collections import OrderedDict
from utils import valid_post_date from utils import valid_post_date
from categories import setHashtagCategory from categories import setHashtagCategory
from utils import dangerousSVG from utils import dangerousSVG
from utils import getFavFilenameFromUrl from utils import get_fav_filename_from_url
from utils import get_base_content_from_post from utils import get_base_content_from_post
from utils import has_object_dict from utils import has_object_dict
from utils import firstParagraphFromString from utils import firstParagraphFromString
@ -184,7 +184,7 @@ def _downloadNewswireFeedFavicon(session, base_dir: str,
return False return False
# save to the cache # save to the cache
favFilename = getFavFilenameFromUrl(base_dir, favUrl) favFilename = get_fav_filename_from_url(base_dir, favUrl)
if os.path.isfile(favFilename): if os.path.isfile(favFilename):
return True return True
try: try:

View File

@ -3238,7 +3238,7 @@ def getNewPostEndpoints() -> []:
) )
def getFavFilenameFromUrl(base_dir: str, faviconUrl: str) -> str: def get_fav_filename_from_url(base_dir: str, faviconUrl: str) -> str:
"""Returns the cached filename for a favicon based upon its url """Returns the cached filename for a favicon based upon its url
""" """
if '://' in faviconUrl: if '://' in faviconUrl:

View File

@ -11,7 +11,7 @@ import os
from datetime import datetime from datetime import datetime
from content import removeLongWords from content import removeLongWords
from content import limitRepeatedWords from content import limitRepeatedWords
from utils import getFavFilenameFromUrl from utils import get_fav_filename_from_url
from utils import get_base_content_from_post from utils import get_base_content_from_post
from utils import removeHtml from utils import removeHtml
from utils import locatePost from utils import locatePost
@ -243,7 +243,8 @@ def _htmlNewswire(base_dir: str, newswire: {}, nickname: str, moderator: bool,
faviconUrl = getNewswireFaviconUrl(url) faviconUrl = getNewswireFaviconUrl(url)
faviconLink = '' faviconLink = ''
if faviconUrl: if faviconUrl:
cachedFaviconFilename = getFavFilenameFromUrl(base_dir, faviconUrl) cachedFaviconFilename = \
get_fav_filename_from_url(base_dir, faviconUrl)
if os.path.isfile(cachedFaviconFilename): if os.path.isfile(cachedFaviconFilename):
faviconUrl = \ faviconUrl = \
cachedFaviconFilename.replace(base_dir, '') cachedFaviconFilename.replace(base_dir, '')
@ -251,7 +252,7 @@ def _htmlNewswire(base_dir: str, newswire: {}, nickname: str, moderator: bool,
extensions = ('png', 'jpg', 'gif', 'avif', 'svg', 'webp') extensions = ('png', 'jpg', 'gif', 'avif', 'svg', 'webp')
for ext in extensions: for ext in extensions:
cachedFaviconFilename = \ cachedFaviconFilename = \
getFavFilenameFromUrl(base_dir, faviconUrl) get_fav_filename_from_url(base_dir, faviconUrl)
cachedFaviconFilename = \ cachedFaviconFilename = \
cachedFaviconFilename.replace('.ico', '.' + ext) cachedFaviconFilename.replace('.ico', '.' + ext)
if os.path.isfile(cachedFaviconFilename): if os.path.isfile(cachedFaviconFilename):