From: Fredrik Tolf Date: Mon, 27 Aug 2012 04:17:30 +0000 (+0200) Subject: Merge branch 'master' into python3 X-Git-Url: http://dolda2000.com/gitweb/?a=commitdiff_plain;h=3e91bb195838a6c561358a44f654f41f46e9c95f;hp=-c;p=wrw.git Merge branch 'master' into python3 Conflicts: wrw/sp/xhtml.py --- 3e91bb195838a6c561358a44f654f41f46e9c95f diff --combined wrw/sp/xhtml.py index 02e8dd6,928dcd9..a7debe6 --- a/wrw/sp/xhtml.py +++ b/wrw/sp/xhtml.py @@@ -1,11 -1,11 +1,11 @@@ -import xml.dom.minidom, StringIO -import cons as _cons -import util +import xml.dom.minidom, io +from . import cons as _cons +from . import util dom = xml.dom.minidom.getDOMImplementation() -ns = u"http://www.w3.org/1999/xhtml" -doctype = u"-//W3C//DTD XHTML 1.1//EN" -dtd = u"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" +ns = "http://www.w3.org/1999/xhtml" +doctype = "-//W3C//DTD XHTML 1.1//EN" +dtd = "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" class htmlelement(_cons.element): def __todoc__(self): @@@ -22,7 -22,7 +22,7 @@@ def head(title=None, css=None) head = h.head if title: head(h.title(title)) - if isinstance(css, str) or isinstance(css, unicode): + if isinstance(css, str) or isinstance(css, bytes): head(h.link(rel="stylesheet", type="text/css", href=css)) elif css: for ss in css: @@@ -30,7 -30,7 +30,7 @@@ return head class htmlformatter(util.formatter): - allowshort = set(["br", "hr", "img", "input"]) - allowshort = set([u"br", u"hr", u"img", u"input", u"meta", u"link"]) ++ allowshort = set(["br", "hr", "img", "input", "meta", "link"]) def element(self, el, **extra): if el.name in self.allowshort: super(htmlformatter, self).element(el, **extra) @@@ -43,7 -43,7 +43,7 @@@ class htmlindenter(util.indenter, htmlf def forreq(req, tree): # XXX: Use proper Content-Type for clients accepting it. req.ohead["Content-Type"] = "text/html; charset=utf-8" - buf = StringIO.StringIO() + buf = io.BytesIO() htmlindenter.output(buf, tree, doctype=(doctype, dtd), charset="utf-8") return [buf.getvalue()]