Log message for revision 68714: DateTime marshalling addendum: Fixed edge case of attribute name ''.
Changed: U Zope/trunk/lib/python/ZPublisher/tests/test_xmlrpc.py U Zope/trunk/lib/python/ZPublisher/xmlrpc.py -=- Modified: Zope/trunk/lib/python/ZPublisher/tests/test_xmlrpc.py =================================================================== --- Zope/trunk/lib/python/ZPublisher/tests/test_xmlrpc.py 2006-06-17 16:32:56 UTC (rev 68713) +++ Zope/trunk/lib/python/ZPublisher/tests/test_xmlrpc.py 2006-06-17 16:33:46 UTC (rev 68714) @@ -191,7 +191,20 @@ response.setBody(body) self.assertRaises(xmlrpclib.Fault, xmlrpclib.loads, faux._body) + def test_emptystringattribute(self): + # Test an edge case: attribute name '' is possible, + # at least in theory. + import xmlrpclib + body = FauxInstance(_secret='abc') + setattr(body, '', True) + faux = FauxResponse() + response = self._makeOne(faux) + response.setBody(body) + data, method = xmlrpclib.loads(faux._body) + data = data[0] + self.assertEqual(data, {'': True}) + def test_suite(): return unittest.TestSuite((unittest.makeSuite(XMLRPCResponseTests),)) Modified: Zope/trunk/lib/python/ZPublisher/xmlrpc.py =================================================================== --- Zope/trunk/lib/python/ZPublisher/xmlrpc.py 2006-06-17 16:32:56 UTC (rev 68713) +++ Zope/trunk/lib/python/ZPublisher/xmlrpc.py 2006-06-17 16:33:46 UTC (rev 68714) @@ -43,7 +43,8 @@ # We want to avoid disclosing private attributes. # Private attributes are by convention named with # a leading underscore character. - value = dict([(k, v) for (k, v) in value.__dict__.items() if k[0] != '_']) + value = dict([(k, v) for (k, v) in value.__dict__.items() + if k[:1] != '_']) self.dump_struct(value, write) xmlrpclib.Marshaller.dispatch[types.InstanceType] = dump_instance _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins