maybe I shouldo nly use buffered writes?

This commit is contained in:
Morten Delenk 2016-07-31 12:04:02 +02:00
parent 01a93657ea
commit 7c27203744
No known key found for this signature in database
GPG key ID: 3F818D0F65DCB490
3 changed files with 6 additions and 6 deletions

View file

@ -2,7 +2,6 @@
from htmlgen import *
import sys
import storage
print("Content-type: text/html\r\n\r\n")
html=htmlgen.HTMLgen(pagelayout.getLayoutXML().decode('utf-8'),"Home Page")
count=storage.count("articles")
for i in range(count):
@ -13,7 +12,8 @@ for i in range(count):
except:
html.addArticle(**storage.get("articles",i), aid=i)
print("<!DOCTYPE html>")
sys.stdout.buffer.write("Content-type: text/html\r\n\r\n".encode('utf8'))
sys.stdout.buffer.write("<!DOCTYPE html>".encode('utf8'))
sys.stdout.buffer.write(html.renderSite().encode('utf8'))
sys.stdout.flush()
#print(html.renderSite())

View file

@ -9,7 +9,6 @@ import base64
from io import BytesIO
from captcha.image import ImageCaptcha
import time, string
print("Content-type: text/html\r\n\r\n")
form=cgi.FieldStorage()
aid=int(form["aid"].value)
try:
@ -46,7 +45,8 @@ count=storage.count("comments-%i"%aid)
for i in range(count):
html.addArticle(aid=aid,**(storage.get("comments-%i"%aid,i)))
print("<!DOCTYPE html>")
sys.stdout.buffer.write("Content-type: text/html\r\n\r\n".encode('utf8'))
sys.stdout.buffer.write("<!DOCTYPE html>".encode('utf8'))
sys.stdout.buffer.write(html.renderSite(True).encode('utf8'))
sys.stdout.flush()
#print(html.renderSite(True))

View file

@ -2,7 +2,6 @@
from htmlgen import *
import sys
import storage
print("Content-type: text/html\r\n\r\n")
html=htmlgen.HTMLgen(pagelayout.getLayoutXML().decode('utf-8'),"Home Page")
count=storage.count("articles")
for i in range(count):
@ -13,7 +12,8 @@ for i in range(count):
except:
html.addArticle(aid=i, **storage.get("articles",i))
print("<!DOCTYPE html>")
sys.stdout.buffer.write("Content-type: text/html\r\n\r\n".encode('utf8'))
sys.stdout.buffer.write("<!DOCTYPE html>".encode('utf8'))
sys.stdout.buffer.write(html.renderSite().encode('utf8'))
sys.stdout.flush()
#print(html.renderSite())