@@ -245,41 +245,15 @@ def __repr__(self):
245
245
246
246
##
247
247
# Backwards compatibility
248
-
249
248
boolean = Boolean = bool
250
249
251
- ##
252
- # Wrapper for XML-RPC DateTime values. This converts a time value to
253
- # the format used by XML-RPC.
254
- # <p>
255
- # The value can be given as a datetime object, as a string in the
256
- # format "yyyymmddThh:mm:ss", as a 9-item time tuple (as returned by
257
- # time.localtime()), or an integer value (as returned by time.time()).
258
- # The wrapper uses time.localtime() to convert an integer to a time
259
- # tuple.
260
- #
261
- # @param value The time, given as a datetime object, an ISO 8601 string,
262
- # a time tuple, or an integer time value.
263
-
264
250
265
- # Issue #13305: different format codes across platforms
266
- _day0 = datetime (1 , 1 , 1 )
267
- def _try (fmt ):
268
- try :
269
- return _day0 .strftime (fmt ) == '0001'
270
- except ValueError :
271
- return False
272
- if _try ('%Y' ): # Mac OS X
273
- def _iso8601_format (value ):
274
- return value .strftime ("%Y%m%dT%H:%M:%S" )
275
- elif _try ('%4Y' ): # Linux
276
- def _iso8601_format (value ):
277
- return value .strftime ("%4Y%m%dT%H:%M:%S" )
278
- else :
279
- def _iso8601_format (value ):
280
- return value .strftime ("%Y%m%dT%H:%M:%S" ).zfill (17 )
281
- del _day0
282
- del _try
251
+ def _iso8601_format (value ):
252
+ if value .tzinfo is not None :
253
+ # XML-RPC only uses the naive portion of the datetime
254
+ value = value .replace (tzinfo = None )
255
+ # XML-RPC doesn't use '-' separator in the date part
256
+ return value .isoformat (timespec = 'seconds' ).replace ('-' , '' )
283
257
284
258
285
259
def _strftime (value ):
0 commit comments