Skip to content.

Etria Lists

 

[quills-dev] [Collective-checkins] r49995 - quills.remoteblogging/trunk/quills/remoteblogging/browser

Tim Hicks tim at sitefusion.co.uk
Mon Sep 24 16:05:19 UTC 2007


Raphael Ritz wrote:
> quills-dev at lists.etria.com wrote:
>> Author: tomster
>> Date: Sun Sep 23 22:19:20 2007
>> New Revision: 49995
>>
> 
> [..]
> 
>> i couldn't find any documentation on how to convert xmlrpc.DateTime into DateTime.DateTime 
> 
> FWIW
> 
> Python 2.4.4 (#2, Apr 12 2007, 21:03:11)
> [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> from xmlrpclib import DateTime as xdt
>  >>> from time import strptime
>  >>> from datetime import datetime
>  >>> xmlrpcdt = xdt()
>  >>> xmlrpcdt
> <DateTime '20070924T10:44:06' at -482578f4>
>  >>> str(xmlrpcdt)
> '20070924T10:44:06'
>  >>> datetimedt = datetime(*strptime(str(xmlrpcdt),"%Y%m%dT%H:%M:%S")[0:6])
>  >>> datetimedt
> datetime.datetime(2007, 9, 24, 10, 44, 6)
>  >>> str(datetimedt)
> '2007-09-24 10:44:06'
>  >>>
> 
> 
> Getting from Python's datetime objects to Zope's DateTime
> is left as an easy exercise ;-)

Thanks Raphael.

I actually just used your code to (re)implement the publication_date
functionality in metaweblogapi, but decided not to commit it.  While
writing tests for this functionality, I realised that I didn't know what
the desired behaviour for publishing an IWeblogEntry in the future would
be.  I mean, would such an entry be returned by getEntries (which
returns only published entries) or getDrafts?

So, it got complicated and I backed off ;-).


Tim


More information about the quills-dev mailing list