[Checkins] SVN: Products.CMFDefault/trunk/Products/CMFDefault/ getUpdateBase adjusted to produce rfc822 formatted date

Charlie Clark cvs-admin at zope.org
Wed Sep 5 11:21:49 UTC 2012


Log message for revision 127704:
  getUpdateBase adjusted to produce rfc822 formatted date

Changed:
  U   Products.CMFDefault/trunk/Products/CMFDefault/SyndicationTool.py
  U   Products.CMFDefault/trunk/Products/CMFDefault/tests/test_SyndicationTool.py

-=-
Modified: Products.CMFDefault/trunk/Products/CMFDefault/SyndicationTool.py
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/SyndicationTool.py	2012-09-05 11:06:08 UTC (rev 127703)
+++ Products.CMFDefault/trunk/Products/CMFDefault/SyndicationTool.py	2012-09-05 11:21:45 UTC (rev 127704)
@@ -228,21 +228,15 @@
     security.declarePublic('getUpdateBase')
     def getUpdateBase(self, obj=None):
         """
-        Return the base date to be used with the update frequency
-        and the update period to calculate a publishing schedule.
-
-        Note:  I'm not sure what's best here, creation date, last
-        modified date (of the folder being syndicated) or some
-        arbitrary date.  For now, I'm going to build a updateBase
-        time from zopetime and reformat it to meet the W3CDTF.
-        Additionally, sitewide policy checks might have a place
-        here...
+        Return the base date formatted as RFC 822 to be used with the update
+        frequency and the update period to calculate a publishing schedule.
         """
         if obj is not None:
             base = self.getSyndicationInfo(obj).base
         else:
             base = self.base
-        return base.isoformat()
+        as_zope = DateTime(base.isoformat())
+        return as_zope.rfc822()
 
     security.declarePublic('getHTML4UpdateBase')
     def getHTML4UpdateBase(self, obj=None):

Modified: Products.CMFDefault/trunk/Products/CMFDefault/tests/test_SyndicationTool.py
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/tests/test_SyndicationTool.py	2012-09-05 11:06:08 UTC (rev 127703)
+++ Products.CMFDefault/trunk/Products/CMFDefault/tests/test_SyndicationTool.py	2012-09-05 11:21:45 UTC (rev 127704)
@@ -213,7 +213,8 @@
         tool = self._makeOne()
         tool.base = NOW
 
-        self.assertEqual(NOW.isoformat(), tool.getUpdateBase())
+        self.assertEqual(NOW.strftime("%a, %d %b %Y %H:%M:%S +0000"),
+                         tool.getUpdateBase())
 
     def test_getUpdateBaseWithContext(self):
         NOW = datetime.now()
@@ -226,7 +227,8 @@
         tool.enableSyndication(context)
         info.base = NOW
 
-        self.assertEqual(NOW.isoformat(), tool.getUpdateBase(context))
+        self.assertEqual(NOW.strftime("%a, %d %b %Y %H:%M:%S +0000"),
+                         tool.getUpdateBase(context))
 
     def test_getHTML4UpdateBase(self):
         NOW = datetime.now()



More information about the checkins mailing list