Commit c1ab37e8 authored by Shane Hathaway's avatar Shane Hathaway

Removed xmlrpclib, deferring to the version in the Python standard library.

xmlrpclib in Python 2.3+ includes support for nil values and basic auth, so
Zope no longer needs to provide its own version.
parent 4f82b0c8
...@@ -46,6 +46,16 @@ class XMLRPCResponseTests(unittest.TestCase): ...@@ -46,6 +46,16 @@ class XMLRPCResponseTests(unittest.TestCase):
self.failUnless('public' in as_set.keys()) self.failUnless('public' in as_set.keys())
self.assertEqual(as_set['public'], 'def') self.assertEqual(as_set['public'], 'def')
def test_nil(self):
import xmlrpclib
body = FauxInstance(public=None)
faux = FauxResponse()
response = self._makeOne(faux)
response.setBody(body)
data, method = xmlrpclib.loads(faux._body)
self.assert_(data[0]['public'] is None)
def test_suite(): def test_suite():
return unittest.TestSuite((unittest.makeSuite(XMLRPCResponseTests),)) return unittest.TestSuite((unittest.makeSuite(XMLRPCResponseTests),))
......
...@@ -98,7 +98,7 @@ class Response: ...@@ -98,7 +98,7 @@ class Response:
def setBody(self, body, title='', is_error=0, bogus_str_search=None): def setBody(self, body, title='', is_error=0, bogus_str_search=None):
if isinstance(body, xmlrpclib.Fault): if isinstance(body, xmlrpclib.Fault):
# Convert Fault object to XML-RPC response. # Convert Fault object to XML-RPC response.
body=xmlrpclib.dumps(body, methodresponse=1) body=xmlrpclib.dumps(body, methodresponse=1, allow_none=True)
else: else:
if type(body) == types.InstanceType: if type(body) == types.InstanceType:
# Avoid disclosing private members. Private members are # Avoid disclosing private members. Private members are
...@@ -117,7 +117,8 @@ class Response: ...@@ -117,7 +117,8 @@ class Response:
# was a Python None. This is now patched in xmlrpclib to # was a Python None. This is now patched in xmlrpclib to
# allow Nones nested inside data structures too. # allow Nones nested inside data structures too.
try: try:
body = xmlrpclib.dumps((body,), methodresponse=1) body = xmlrpclib.dumps(
(body,), methodresponse=1, allow_none=True)
except: except:
self.exception() self.exception()
return return
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment