[XML-SIG] Minor patch to xml.pickle.generic?
Uche Ogbuji
uche.ogbuji@fourthought.com
Mon, 07 Oct 2002 22:34:55 -0600
In this message:
http://groups.google.com/groups?selm=mailman.1031185928.10194.python-list%40pyt
hon.org
Most of the patch just looks like the guy is not using the APIs rightly, but
this part looks valid:
--- xml_pickle.py.orig Tue Sep 3 18:38:48 2002
+++ xml_pickle.py Wed Sep 4 20:18:34 2002
@@ -206,7 +206,7 @@
'<!DOCTYPE PyObject SYSTEM "PyObjects.dtd">\n',
'<PyObject class="%s" id="%s">\n'
% (_klass(self.py_obj),id_)]
- for name in dir(self.py_obj):
+ for name in self.py_obj.__dict__.keys():
xml_lines.append(_attr_tag(name, getattr(self, name)))
xml_lines.append('</PyObject>\n')
return string.join(xml_lines,'')
@@ -452,7 +452,7 @@
visited[id(thing)] = 1
start_tag = start_tag + 'type="PyObject" class="%s" id="%s">\n' \
% (_klass(thing), id(thing))
- for name in dir(thing):
+ for name in thing.__dict__.keys():
tag_body.append(_attr_tag(name, getattr(thing, name),
level+1))
elif '%s' % type(thing) == "<type 'SRE_Pattern'>":
# SRE_Pattern objects are extension objects, so not
--
Should I check that in? I know that dir() result can differ from
__dict__.keys() result, but not in ways that I think would affect this.
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.net http://4Suite.org http://fourthought.com
Apache 2.0 API - http://www-106.ibm.com/developerworks/linux/library/l-apache/
Python&XML column: Tour of Python/XML - http://www.xml.com/pub/a/2002/09/18/py.
html
Python/Web Services column: xmlrpclib - http://www-106.ibm.com/developerworks/w
ebservices/library/ws-pyth10.html