Skip to content.

Etria Lists

 

[quills-dev] [Collective-checkins] r32146 - Quills/trunk

quills-dev at lists.etria.com quills-dev at lists.etria.com
Mon Oct 23 01:02:41 UTC 2006


Author: tomster
Date: Mon Oct 23 01:02:41 2006
New Revision: 32146

Modified:
   Quills/trunk/MetaWeblogAPI.py
Log:
bugfix for Zope versions > 2.9.3:

 * Zope 2.9.3 introduced recognition of XML-RPC !DateTime objects (previously it treated them as strings, which prevented proper treatment of them by clients), however, the `DateTime` class of Python's [http://docs.python.org/lib/datetime-objects.html xmlrpclib] doesn't offer any way to create an actual `datetime`- (or `DateTime`-) object, so I introduced a string-based hack to create a valid !DateTime instance.
 * For the same reason it is no longer advisable to write a string representation of the modified date into the XML-RPC dict.

This change probably breaks !MetaWeblog-functionality for pre Zope 2.9.3-based instances. Affected users will either have to update or provide a patch that isn't quite as oblivious to the Zope version running it as this... sorry, but I'm absolutely scratching my own proverbial itch here... 

Modified: Quills/trunk/MetaWeblogAPI.py
==============================================================================
--- Quills/trunk/MetaWeblogAPI.py	(original)
+++ Quills/trunk/MetaWeblogAPI.py	Mon Oct 23 01:02:41 2006
@@ -77,7 +77,17 @@
                             struct.get('dateCreated',
                                        DateTime.DateTime())
                             )
-        return ed
+        # due to strange developments in Zope2.9 resp. xmlrpclib we need to parse 
+        # the XMLRPC-DateTime object's string representation and then construct a
+        # 'proper' DateTime instance from a string assembled from those parsed bits.
+        try:
+            val = ed.value
+            datetime_string = "%s-%s-%s%s" % (val[0:4], val[4:6], val[6:8], val[8:]) 
+            return DateTime.DateTime(datetime_string)
+        except AttributeError:
+            # we obviously didn't receive a xmlrpclib DateTime instance, so we
+            # can return it unchanged:
+            return ed
 
     security.declareProtected(CMFCorePermissions.ModifyPortalContent, 'newPost')
     def newPost(self, blogid, username, password, struct, publish):
@@ -326,7 +336,7 @@
 
         struct = {
             'postid': obj.UID(),
-            'dateCreated': obj.effective().rfc822(),
+            'dateCreated': obj.effective(),
             'title': obj.Title(),
             'description' : body,
             'categories' : [cat.getId() for cat in obj.getCategories()],

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Collective-checkins mailing list
Collective-checkins at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/collective-checkins



More information about the quills-dev mailing list