Skip to content

Commit

Permalink
Implement changes suggested in code review.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Howitz committed May 12, 2020
1 parent 0d33ac9 commit 0cdfe75
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
5 changes: 2 additions & 3 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
4.3.0 (unreleased)
==================

- Support options *use_datetime* (Python >= 2.7) and *use_builtin_types*
(Python >= 3.5) of ``ServerProxy``.
(`Python >= 3.5`) of ``ServerProxy``.
- Support options *use_datetime* (Python >= 2.7) and *use_builtin_types*
(`Python >= 3.5`) in ``.xmlrpc.testing.ServerProxy``.


4.2.0 (2019-12-05)
Expand Down
5 changes: 1 addition & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,7 @@ def _read(fname):
],
extras_require={
'test': tests_require,
'testing': [
'six',
'zope.app.wsgi',
]
'testing': 'zope.app.wsgi',
},
tests_require=tests_require,
zip_safe=False,
Expand Down
20 changes: 10 additions & 10 deletions src/zope/app/publisher/xmlrpc/testing.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
try:
import xmlrpclib
except ImportError:
except ImportError: # PY3
import xmlrpc.client as xmlrpclib

try:
import httplib
except ImportError:
except ImportError: # PY3
import http.client as httplib

from io import BytesIO
import six

from zope.app.wsgi.testlayer import http as _http

Expand Down Expand Up @@ -89,14 +88,15 @@ def request(self, host, handler, request_body, verbose=0):

def ServerProxy(wsgi_app, uri, transport=None, encoding=None,
verbose=0, allow_none=0, handleErrors=True,
use_datetime=False, use_builtin_types=False):
"""A factory that creates a server proxy using the ZopeTestTransport
by default.
**transport_options):
"""A factory that creates a server proxy.
If ``transport`` is ``None`` use the ``ZopeTestTransport``, it gets
initialized with ``**transport_options``. Which options are supported
depends on the used Python version, see
``xmlrpc.client.Transport.__init__`` resp. ``xmlrpclib.Transport.__init__``
for details.
"""
transport_options = dict(use_datetime=use_datetime)
if six.PY3:
# use_builtin_types is only available since 3.3
transport_options['use_builtin_types'] = use_builtin_types
if transport is None:
transport = ZopeTestTransport(**transport_options)
transport.wsgi_app = wsgi_app
Expand Down

0 comments on commit 0cdfe75

Please sign in to comment.