classification
Title: use_builtin_types in xmlrpc.server
Type: enhancement Stage: resolved
Components: Library (Lib), XML Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: 13297 Superseder:
Assigned To: flox Nosy List: BreamoreBoy, eric.araujo, flox, loewis, neologix, python-dev, schmir, vdupras
Priority: normal Keywords: patch

Created on 2008-05-27 00:09 by vdupras, last changed 2011-12-09 21:37 by python-dev. This issue is now closed.

Files
File name Uploaded Description Edit
SimpleXMLRPCServer_use_datetime.diff vdupras, 2008-05-27 00:09 review
issue2979_xmlrpc_server.diff flox, 2011-11-10 20:36
issue2979_xmlrpc_server_v2.diff flox, 2011-11-15 20:32 review
Messages (10)
msg67400 - (view) Author: Virgil Dupras (vdupras) (Python triager) Date: 2008-05-27 00:09
It seems strange to me that xmlrpclib.ServerProxy has a use_datetime 
argument, but not SimpleXMLRPCServer or CGIXMLRPCRequestHandler.

I'm hereby submitting a patch to fix this.

Sorry for the shaky testing (I only really test SimpleXMLRPCDispatcher), 
but trying to test at the SimpleXMLRPCServer level using the current http_server() scheme quickly became dirty, so I backed off.
msg109652 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-07-09 00:51
Presumably the patch needs reworking as SimpleXMLRPCServer has been incorporated into the new xmlrpc package for Python 3.
msg111300 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-07-23 12:34
At EuroPython, Virgil remarked that there was some discussion of this patch somewhere.
msg146689 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2011-10-31 10:55
2096158376e5 broke test_xmlrpc:

"""
======================================================================
ERROR: test_datetime_before_1900 (test.test_xmlrpc.XMLRPCTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/cf/python/cpython/Lib/test/test_xmlrpc.py", line 62, in test_datetime_before_1900
    (newdt,), m = xmlrpclib.loads(s, use_datetime=1)
  File "/home/cf/python/cpython/Lib/xmlrpc/client.py", line 969, in loads
    p.feed(data)
  File "/home/cf/python/cpython/Lib/xmlrpc/client.py", line 430, in feed
    self._parser.Parse(data, 0)
  File "/home/cf/python/cpython/Lib/xmlrpc/client.py", line 662, in end
    return f(self, "".join(self._data))
  File "/home/cf/python/cpython/Lib/xmlrpc/client.py", line 745, in end_dateTime
    value = _datetime_type(data)
  File "/home/cf/python/cpython/Lib/xmlrpc/client.py", line 359, in _datetime_type
    return datetime.strptime(data, "%Y%m%dT%H:%M:%S")
  File "/home/cf/python/cpython/Lib/_strptime.py", line 488, in _strptime_datetime
    tt, fraction = _strptime(data_string, format)
  File "/home/cf/python/cpython/Lib/_strptime.py", line 337, in _strptime
    (data_string, format))
ValueError: time data '10210T11:41:23' does not match format '%Y%m%dT%H:%M:%S'

----------------------------------------------------------------------
"""

That's because datetime.strptime() expects a year ("%Y") on exactly 4 digits:
"""
            #XXX: Does 'Y' need to worry about having less or more than
            #     4 digits?
            'Y': r"(?P<Y>\d\d\d\d)",
"""
msg146756 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2011-11-01 00:18
Latest comment is unrelated to this feature request.
It goes with issue #13305.
msg147400 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2011-11-10 08:49
See issue #13297 for a similar case with bytes.

Should we implement a "use_builtin_types" flag which supersedes "use_datetime"?
msg147410 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2011-11-10 20:36
This is the proposed patch which could be applied after issue #13297 is solved.
msg147702 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2011-11-15 20:32
Patch updated with documentation.
msg147845 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-11-18 10:17
Looks good.
msg149128 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-12-09 21:37
New changeset b3c1a504ebc1 by Florent Xicluna in branch 'default':
Closes #2979: add parameter 'use_builtin_types' to the SimpleXMLRPCServer.
http://hg.python.org/cpython/rev/b3c1a504ebc1
History
Date User Action Args
2011-12-09 21:37:18python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg149128

resolution: fixed
stage: commit review -> resolved
2011-11-18 10:17:33eric.araujosetmessages: + msg147845
2011-11-15 20:32:03floxsetfiles: + issue2979_xmlrpc_server_v2.diff

nosy: + eric.araujo
messages: + msg147702

stage: patch review -> commit review
2011-11-10 20:39:32floxsetcomponents: + XML
title: use_builtin_types in SimpleXMLRPCServer -> use_builtin_types in xmlrpc.server
2011-11-10 20:36:10floxsetfiles: + issue2979_xmlrpc_server.diff

messages: + msg147410
title: use_datetime in SimpleXMLRPCServer -> use_builtin_types in SimpleXMLRPCServer
2011-11-10 08:49:50floxsetdependencies: + xmlrpc.client could accept bytes for input and output
messages: + msg147400
2011-11-01 00:18:58floxsetmessages: + msg146756
2011-10-31 10:55:16neologixsetnosy: + neologix
messages: + msg146689
2011-10-31 00:35:47floxsetassignee: flox
2011-10-30 23:29:19floxsetnosy: + flox
stage: needs patch -> patch review

versions: + Python 3.3, - Python 3.2
2010-07-23 12:34:17loewissetnosy: + loewis
messages: + msg111300
2010-07-09 00:51:21BreamoreBoysetversions: + Python 3.2, - Python 2.6
nosy: + BreamoreBoy

messages: + msg109652

stage: needs patch
2008-05-28 18:59:32schmirsetnosy: + schmir
2008-05-27 00:09:48vduprascreate