X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=wrw%2Fsp%2Fcons.py;h=bc9bfa2b23188831a2c3157de1683e5ff7ee8551;hb=0d4c1b8b8da9e20c4bc9fb41ff1136283821b98e;hp=ff0d0afa317547a353cca729858b65852db72484;hpb=85ed5fa5dae0fe236584926824f7292b6e697e76;p=wrw.git diff --git a/wrw/sp/cons.py b/wrw/sp/cons.py index ff0d0af..bc9bfa2 100644 --- a/wrw/sp/cons.py +++ b/wrw/sp/cons.py @@ -40,7 +40,7 @@ class element(node): return self.__todom__(doc).toxml() class context(object): - charset = sys.getfilesystemencoding() + charset = (sys.getfilesystemencoding() or "ascii") def __init__(self): self.nodeconv = {} @@ -60,6 +60,8 @@ class context(object): raise Exception("No node conversion known for %s objects" % str(type(ob))) def addchild(self, node, child): + if child is None: + return node.children.append(self.nodefrom(child)) def addattr(self, node, k, v): @@ -75,3 +77,9 @@ class constructor(object): def __getattr__(self, name): return self._elcls(self._ns, name, self._ctx) + +class doctype(node): + def __init__(self, rootname, pubid, dtdid): + self.rootname = rootname + self.pubid = pubid + self.dtdid = dtdid