Dolda2000 GitWeb
/
wrw.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed phttpdate bug.
[wrw.git]
/
wrw
/
sp
/
cons.py
diff --git
a/wrw/sp/cons.py
b/wrw/sp/cons.py
index
ce258c6
..
1e3d678
100644
(file)
--- a/
wrw/sp/cons.py
+++ b/
wrw/sp/cons.py
@@
-1,3
+1,4
@@
+import sys
import xml.dom.minidom
class node(object):
import xml.dom.minidom
class node(object):
@@
-39,9
+40,11
@@
class element(node):
return self.__todom__(doc).toxml()
class context(object):
return self.__todom__(doc).toxml()
class context(object):
+ charset = (sys.getfilesystemencoding() or "ascii")
+
def __init__(self):
self.nodeconv = {}
def __init__(self):
self.nodeconv = {}
- self.nodeconv[str] = lambda ob: text(ob,
"utf-8"
)
+ self.nodeconv[str] = lambda ob: text(ob,
self.charset
)
self.nodeconv[unicode] = text
self.nodeconv[int] = text
self.nodeconv[long] = text
self.nodeconv[unicode] = text
self.nodeconv[int] = text
self.nodeconv[long] = text
@@
-60,7
+63,8
@@
class context(object):
node.children.append(self.nodefrom(child))
def addattr(self, node, k, v):
node.children.append(self.nodefrom(child))
def addattr(self, node, k, v):
- node.attrs[unicode(k)] = unicode(v)
+ if v is not None:
+ node.attrs[unicode(k)] = unicode(v)
class constructor(object):
def __init__(self, ns, elcls=element, ctx=None):
class constructor(object):
def __init__(self, ns, elcls=element, ctx=None):