main
Bob Mottram 2020-02-24 20:05:31 +00:00
parent 502d7ad9c5
commit e999879c19
2 changed files with 2 additions and 9 deletions

View File

@ -951,7 +951,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.translate, \ self.server.translate, \
nickname,self.server.domain, \ nickname,self.server.domain, \
postJsonObject) postJsonObject)
if msg: if msg!=None:
print("Test sending blog post")
msg=msg.encode() msg=msg.encode()
self._set_headers('text/html',len(msg),cookie) self._set_headers('text/html',len(msg),cookie)
self._write(msg) self._write(msg)

View File

@ -5011,23 +5011,17 @@ def htmlBlogPost(baseDir: str,httpPrefix: str,translate: {}, \
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'
print("Test cssFilename="+cssFilename)
with open(cssFilename, 'r') as cssFile: with open(cssFilename, 'r') as cssFile:
print("Test cssFilename loaded 1")
blogCSS=cssFile.read() blogCSS=cssFile.read()
print("Test cssFilename loaded 2")
blogStr=htmlHeader(cssFilename,blogCSS) blogStr=htmlHeader(cssFilename,blogCSS)
print("Test cssFilename loaded 3 "+blogStr)
if postJsonObject['object'].get('summary'): if postJsonObject['object'].get('summary'):
blogStr+='<h1>'+postJsonObject['object']['summary']+'</h1>\n' blogStr+='<h1>'+postJsonObject['object']['summary']+'</h1>\n'
print("Test cssFilename loaded 4 "+blogStr)
if postJsonObject['object'].get('published'): if postJsonObject['object'].get('published'):
if 'T' in postJsonObject['object']['published']: if 'T' in postJsonObject['object']['published']:
blogStr+='<h3>'+postJsonObject['object']['published'].split('T')[0]+'</h3>\n' blogStr+='<h3>'+postJsonObject['object']['published'].split('T')[0]+'</h3>\n'
print("Test cssFilename loaded 5 "+blogStr)
if postJsonObject['object'].get('content'): if postJsonObject['object'].get('content'):
contentStr=addEmbeddedElements(translate,postJsonObject['object']['content']) contentStr=addEmbeddedElements(translate,postJsonObject['object']['content'])
if postJsonObject['object'].get('tag'): if postJsonObject['object'].get('tag'):
@ -5036,12 +5030,10 @@ def htmlBlogPost(baseDir: str,httpPrefix: str,translate: {}, \
postJsonObject['object']['tag'],'content') postJsonObject['object']['tag'],'content')
blogStr+=contentStr+'\n' blogStr+=contentStr+'\n'
print("Test cssFilename loaded 6 "+blogStr)
blogStr+='<hr>\n' blogStr+='<hr>\n'
blogStr+= \ blogStr+= \
'<p class="about"><a href="'+httpPrefix+'://'+domain+ \ '<p class="about"><a href="'+httpPrefix+'://'+domain+ \
'/users/'+nickname+'">'+translate['About the author']+'</a></p>\n' '/users/'+nickname+'">'+translate['About the author']+'</a></p>\n'
print("Test blogStr="+blogStr)
return blogStr+htmlFooter() return blogStr+htmlFooter()
return None return None