[Checkins] SVN: Products.CMFDefault/trunk/Products/CMFDefault/ Test strictly for HTML4 style output and enforce timezone ignorance by passing in a string to DateTime's constructor.
Charlie Clark
charlie at begeistert.org
Sun Nov 20 18:53:44 UTC 2011
Log message for revision 123449:
Test strictly for HTML4 style output and enforce timezone ignorance by passing in a string to DateTime's constructor.
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 2011-11-20 18:11:15 UTC (rev 123448)
+++ Products.CMFDefault/trunk/Products/CMFDefault/SyndicationTool.py 2011-11-20 18:53:44 UTC (rev 123449)
@@ -246,8 +246,15 @@
warn("RSS 2.0 uses RFC 822 formatting"
" this method will be removed in CMF 2.4",
DeprecationWarning, stacklevel=2)
- # HTML4 is the same as isoformat()
- return self.getUpdateBase(obj)
+ # HTML4 is almost the same as isoformat()
+ if obj is not None:
+ base = obj.base
+ else:
+ base = self.base
+ # normalise
+ base = base.replace(tzinfo=None)
+ as_zope = DateTime(base.isoformat())
+ return as_zope.HTML4()
def getMaxItems(self, obj=None):
"""
Modified: Products.CMFDefault/trunk/Products/CMFDefault/tests/test_SyndicationTool.py
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/tests/test_SyndicationTool.py 2011-11-20 18:11:15 UTC (rev 123448)
+++ Products.CMFDefault/trunk/Products/CMFDefault/tests/test_SyndicationTool.py 2011-11-20 18:53:44 UTC (rev 123449)
@@ -235,7 +235,7 @@
tool.base = NOW
as_HTML4 = tool.getHTML4UpdateBase()
- self.assertEqual(as_HTML4, NOW.isoformat())
+ self.assertEqual(NOW.strftime("%Y-%m-%dT%H:%M:%SZ"), as_HTML4)
def test_getHTML4UpdateBaseWithContext(self):
NOW = datetime.now()
@@ -249,8 +249,9 @@
info.base = NOW
as_HTML4 = tool.getHTML4UpdateBase(context)
- self.assertEqual(NOW.isoformat(), as_HTML4)
+ self.assertEqual(NOW.strftime("%Y-%m-%dT%H:%M:%SZ"), as_HTML4)
+
def test_getMaxItems(self):
max_items = 5
More information about the checkins
mailing list