Remove css load from blog

main
Bob Mottram 2020-11-12 16:05:45 +00:00
parent a7bbe4a7d9
commit 96ed5f2696
1 changed files with 126 additions and 140 deletions

24
blog.py
View File

@ -11,7 +11,7 @@ from datetime import datetime
from content import replaceEmojiFromTags from content import replaceEmojiFromTags
from webapp import getIconsDir from webapp import getIconsDir
from webapp import htmlHeader from webapp import htmlHeaderWithExternalStyle
from webapp import htmlFooter from webapp import htmlFooter
from webapp_media import addEmbeddedElements from webapp_media import addEmbeddedElements
from webapp_utils import getPostAttachmentsAsHtml from webapp_utils import getPostAttachmentsAsHtml
@ -381,9 +381,7 @@ def htmlBlogPost(authorized: bool,
cssFilename = baseDir + '/epicyon-blog.css' cssFilename = baseDir + '/epicyon-blog.css'
if os.path.isfile(baseDir + '/blog.css'): if os.path.isfile(baseDir + '/blog.css'):
cssFilename = baseDir + '/blog.css' cssFilename = baseDir + '/blog.css'
with open(cssFilename, 'r') as cssFile: blogStr = htmlHeaderWithExternalStyle(cssFilename)
blogCSS = cssFile.read()
blogStr = htmlHeader(cssFilename, blogCSS)
htmlBlogRemoveCwButton(blogStr, translate) htmlBlogRemoveCwButton(blogStr, translate)
blogStr += htmlBlogPostContent(authorized, baseDir, blogStr += htmlBlogPostContent(authorized, baseDir,
@ -413,7 +411,6 @@ def htmlBlogPost(authorized: bool,
blogStr += '</p>' blogStr += '</p>'
return blogStr + htmlFooter() return blogStr + htmlFooter()
return None
def htmlBlogPage(authorized: bool, session, def htmlBlogPage(authorized: bool, session,
@ -430,9 +427,7 @@ def htmlBlogPage(authorized: bool, session,
cssFilename = baseDir + '/epicyon-profile.css' cssFilename = baseDir + '/epicyon-profile.css'
if os.path.isfile(baseDir + '/epicyon.css'): if os.path.isfile(baseDir + '/epicyon.css'):
cssFilename = baseDir + '/epicyon.css' cssFilename = baseDir + '/epicyon.css'
with open(cssFilename, 'r') as cssFile: blogStr = htmlHeaderWithExternalStyle(cssFilename)
blogCSS = cssFile.read()
blogStr = htmlHeader(cssFilename, blogCSS)
htmlBlogRemoveCwButton(blogStr, translate) htmlBlogRemoveCwButton(blogStr, translate)
blogsIndex = baseDir + '/accounts/' + \ blogsIndex = baseDir + '/accounts/' + \
@ -506,9 +501,7 @@ def htmlBlogPage(authorized: bool, session,
# iconsDir + '/rss3.png" /></a>' # iconsDir + '/rss3.png" /></a>'
blogStr += '</p>' blogStr += '</p>'
return blogStr + htmlFooter() return blogStr + htmlFooter()
return None
def htmlBlogPageRSS2(authorized: bool, session, def htmlBlogPageRSS2(authorized: bool, session,
@ -678,9 +671,7 @@ def htmlBlogView(authorized: bool,
cssFilename = baseDir + '/epicyon-profile.css' cssFilename = baseDir + '/epicyon-profile.css'
if os.path.isfile(baseDir + '/epicyon.css'): if os.path.isfile(baseDir + '/epicyon.css'):
cssFilename = baseDir + '/epicyon.css' cssFilename = baseDir + '/epicyon.css'
with open(cssFilename, 'r') as cssFile: blogStr = htmlHeaderWithExternalStyle(cssFilename)
blogCSS = cssFile.read()
blogStr = htmlHeader(cssFilename, blogCSS)
if noOfBlogAccounts(baseDir) <= 1: if noOfBlogAccounts(baseDir) <= 1:
nickname = singleBlogAccountNickname(baseDir) nickname = singleBlogAccountNickname(baseDir)
@ -711,7 +702,6 @@ def htmlBlogView(authorized: bool,
blogStr += '</p>' blogStr += '</p>'
return blogStr + htmlFooter() return blogStr + htmlFooter()
return None
def htmlEditBlog(mediaInstance: bool, translate: {}, def htmlEditBlog(mediaInstance: bool, translate: {},
@ -744,10 +734,6 @@ def htmlEditBlog(mediaInstance: bool, translate: {},
cssFilename = baseDir + '/epicyon-profile.css' cssFilename = baseDir + '/epicyon-profile.css'
if os.path.isfile(baseDir + '/epicyon.css'): if os.path.isfile(baseDir + '/epicyon.css'):
cssFilename = baseDir + '/epicyon.css' cssFilename = baseDir + '/epicyon.css'
with open(cssFilename, 'r') as cssFile:
editBlogCSS = cssFile.read()
if httpPrefix != 'https':
editBlogCSS = editBlogCSS.replace('https://', httpPrefix+'://')
if '?' in path: if '?' in path:
path = path.split('?')[0] path = path.split('?')[0]
@ -794,7 +780,7 @@ def htmlEditBlog(mediaInstance: bool, translate: {},
dateAndLocation += '<input type="text" name="location">' dateAndLocation += '<input type="text" name="location">'
dateAndLocation += '</div>' dateAndLocation += '</div>'
editBlogForm = htmlHeader(cssFilename, editBlogCSS) editBlogForm = htmlHeaderWithExternalStyle(cssFilename)
editBlogForm += \ editBlogForm += \
'<form enctype="multipart/form-data" method="POST" ' + \ '<form enctype="multipart/form-data" method="POST" ' + \