node.children.append(self.nodefrom(child))
def addattr(self, node, k, v):
- node.attrs[str(k)] = str(v)
+ if v is not None:
- node.attrs[unicode(k)] = unicode(v)
++ node.attrs[str(k)] = str(v)
class constructor(object):
def __init__(self, ns, elcls=element, ctx=None):
return doc
class xhtmlcontext(_cons.context):
- attrmap = {u"klass": u"class"}
+ attrmap = {"klass": "class"}
def addattr(self, node, k, v):
- k = unicode(k)
- super(xhtmlcontext, self).addattr(node, self.attrmap.get(k, k), v)
+ k = str(k)
- node.attrs[self.attrmap.get(k, k)] = str(v)
++ super().addattr(node, self.attrmap.get(k, k), v)
def cons(ctx=None):
if ctx is None: ctx = xhtmlcontext()