X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=wrw%2Fsp%2Fxhtml.py;h=447c1b17827a659016f636cbc12d97ffd3c97012;hb=d22f3483df089fc239b4182807c12aaab5ab1c7d;hp=928dcd9ab46db41d88d3810a257adec64aeb0495;hpb=d11a27e202a7c7a4698778e5f30bbe2c9f9a56fe;p=wrw.git diff --git a/wrw/sp/xhtml.py b/wrw/sp/xhtml.py index 928dcd9..447c1b1 100644 --- a/wrw/sp/xhtml.py +++ b/wrw/sp/xhtml.py @@ -14,7 +14,15 @@ class htmlelement(_cons.element): doc.appendChild(self.__todom__(doc)) return doc +class xhtmlcontext(_cons.context): + attrmap = {u"klass": u"class"} + + def addattr(self, node, k, v): + k = unicode(k) + node.attrs[self.attrmap.get(k, k)] = unicode(v) + def cons(ctx=None): + if ctx is None: ctx = xhtmlcontext() return _cons.constructor(ns, htmlelement, ctx) def head(title=None, css=None): @@ -50,4 +58,5 @@ def forreq(req, tree): def xhtmlresp(callable): def wrapper(req): return forreq(req, callable(req)) + wrapper.__wrapped__ = callable return wrapper