[Python-Dev] Re: [Python-checkins] python/dist/src/Lib xmlrpclib.py, 1.38, 1.39

2005-02-10 Thread Tim Peters
[EMAIL PROTECTED]
 Modified Files:
xmlrpclib.py
 Log Message:
 accept datetime.datetime instances when marshalling;
 dateTime.iso8601 elements still unmarshal into xmlrpclib.DateTime objects
 
 Index: xmlrpclib.py

...

 +if datetime and isinstance(value, datetime.datetime):
 +self.value = value.strftime(%Y%m%dT%H:%M:%S)
 +return

... [and similarly later] ...

Fred, is there a reason to avoid datetime.datetime's .isoformat()
method here?  Like so:

 import datetime
 print datetime.datetime(2005, 2, 10, 14, 0, 8).isoformat()
2005-02-10T14:00:08

A possible downside is that you'll also get fractional seconds if the
instance records a non-zero .microseconds value.
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Re: [Python-checkins] python/dist/src/Lib xmlrpclib.py, 1.38, 1.39

2005-02-10 Thread Fred L. Drake, Jr.
On Thursday 10 February 2005 14:09, Tim Peters wrote:
  Fred, is there a reason to avoid datetime.datetime's .isoformat()
  method here?  Like so:

Yes.  The XML-RPC spec is quite vague.  It claims that the dates are in ISO 
8601 format, but doesn't say anything more about it.  The example shows a 
string without hyphens (but with colons), so I stuck with eactly that.

  A possible downside is that you'll also get fractional seconds if the
  instance records a non-zero .microseconds value.

There's nothing in the XML-RPC spec about the resolution of time, so, again, 
I'd rather be conservative in what we generate.


  -Fred

-- 
Fred L. Drake, Jr.  fdrake at acm.org

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Re: [Python-checkins] python/dist/src/Lib xmlrpclib.py, 1.38, 1.39

2005-02-10 Thread Tim Peters
[Tim]
 Fred, is there a reason to avoid datetime.datetime's .isoformat()
 method here?  Like so:

 Yes.  The XML-RPC spec is quite vague.  It claims that the dates are in ISO
 8601 format, but doesn't say anything more about it.  The example shows a
 string without hyphens (but with colons), so I stuck with eactly that.

Well, then since that isn't ISO 8601 format, it would be nice to have
a comment explaining why it's claiming to be anyway 0.5 wink.

 A possible downside is that you'll also get fractional seconds if the
 instance records a non-zero .microseconds value.

 There's nothing in the XML-RPC spec about the resolution of time, so, again,
 I'd rather be conservative in what we generate.

dt.replace(microsecond=0).isoformat()

suffices for that much.  Tack on .replace('-', '') to do the whole job.
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Re: [Python-checkins] python/dist/src/Lib xmlrpclib.py, 1.38, 1.39

2005-02-10 Thread Fred L. Drake, Jr.
On Thursday 10 February 2005 14:44, Tim Peters wrote:
  Well, then since that isn't ISO 8601 format, it would be nice to have
  a comment explaining why it's claiming to be anyway 0.5 wink.

Hmm, that's right (ISO 8601:2000, section 5.4.2).  Sigh.

  dt.replace(microsecond=0).isoformat()
 
  suffices for that much.  Tack on .replace('-', '') to do the whole job.

Yep, that would work too.


  -Fred

-- 
Fred L. Drake, Jr.  fdrake at acm.org

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Re: [Python-checkins] python/dist/src/Lib xmlrpclib.py, 1.38, 1.39

2005-02-10 Thread Fred L. Drake, Jr.
On Thursday 10 February 2005 14:44, Tim Peters wrote:
  Well, then since that isn't ISO 8601 format, it would be nice to have
  a comment explaining why it's claiming to be anyway 0.5 wink.

I've posted a note on the XML-RPC list about this.  There doesn't seem to be 
anything that describes the range of what's accepted and produced by the 
various XML-RPC libraries, but I've not looked hard for it.


  -Fred

-- 
Fred L. Drake, Jr.  fdrake at acm.org

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Re: [Python-checkins] python/dist/src/Lib xmlrpclib.py, 1.38, 1.39

2005-02-10 Thread David Ascher
On Thu, 10 Feb 2005 15:32:14 -0500, Fred L. Drake, Jr. [EMAIL PROTECTED] 
wrote:
 On Thursday 10 February 2005 14:44, Tim Peters wrote:
   Well, then since that isn't ISO 8601 format, it would be nice to have
   a comment explaining why it's claiming to be anyway 0.5 wink.
 
 I've posted a note on the XML-RPC list about this.  There doesn't seem to be
 anything that describes the range of what's accepted and produced by the
 various XML-RPC libraries, but I've not looked hard for it.

Is there any surprise here? =)
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Re: [Python-checkins] python/dist/src/Lib xmlrpclib.py, 1.38, 1.39

2005-02-10 Thread Tim Peters
[Tim]
 Well, then since that isn't ISO 8601 format, it would be nice to have
 a comment explaining why it's claiming to be anyway 0.5 wink.

[Fred]
 Hmm, that's right (ISO 8601:2000, section 5.4.2).  Sigh.

Ain't your fault.  I didn't remember that I had seen the XML-RPC spec
before, in conjunction with its crazy rules for representing floats. 
It's a very vague doc indeed.

Anyway, some quick googling strongly suggests that many XML-RPC
implementors don't know anything about 8601 either, and accept/produce
only the non-8601 format inferred from the single example in the
spec.  Heh -- kids wink.
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com