[Zope-Checkins] SVN: Zope/trunk/lib/python/DateTime/DateTime.py typos
Log message for revision 30497: typos Changed: U Zope/trunk/lib/python/DateTime/DateTime.py -=- Modified: Zope/trunk/lib/python/DateTime/DateTime.py === --- Zope/trunk/lib/python/DateTime/DateTime.py 2005-05-25 12:39:42 UTC (rev 30496) +++ Zope/trunk/lib/python/DateTime/DateTime.py 2005-05-25 12:41:11 UTC (rev 30497) @@ -1489,10 +1489,10 @@ zself = self + tzdiff/86400.0 microseconds = int((zself._second - zself._nearsec) * 100) -# Note: in older version strftime() accept also unicode strings +# Note: in older versions strftime() accepted also unicode strings # as format strings (just because time.strftime() did not perform # any type checking). So we convert unicode strings to utf8, -# pass them to strftime and convert them back to unicode if necessary +# pass them to strftime and convert them back to unicode if necessary. format_is_unicode = False if isinstance(format, unicode): ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/lib/python/DateTime/DateTime.py typos
Log message for revision 30496: typos Changed: U Zope/branches/Zope-2_8-branch/lib/python/DateTime/DateTime.py -=- Modified: Zope/branches/Zope-2_8-branch/lib/python/DateTime/DateTime.py === --- Zope/branches/Zope-2_8-branch/lib/python/DateTime/DateTime.py 2005-05-25 12:38:22 UTC (rev 30495) +++ Zope/branches/Zope-2_8-branch/lib/python/DateTime/DateTime.py 2005-05-25 12:39:42 UTC (rev 30496) @@ -1489,10 +1489,10 @@ zself = self + tzdiff/86400.0 microseconds = int((zself._second - zself._nearsec) * 100) -# Note: in older version strftime() accept also unicode strings +# Note: in older versions strftime() accepted also unicode strings # as format strings (just because time.strftime() did not perform # any type checking). So we convert unicode strings to utf8, -# pass them to strftime and convert them back to unicode if necessary +# pass them to strftime and convert them back to unicode if necessary. format_is_unicode = False if isinstance(format, unicode): ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/lib/python/DateTime/DateTime.py strftime() accepts unicode format strings again
Log message for revision 30495: strftime() accepts unicode format strings again Changed: U Zope/branches/Zope-2_8-branch/lib/python/DateTime/DateTime.py -=- Modified: Zope/branches/Zope-2_8-branch/lib/python/DateTime/DateTime.py === --- Zope/branches/Zope-2_8-branch/lib/python/DateTime/DateTime.py 2005-05-25 12:36:25 UTC (rev 30494) +++ Zope/branches/Zope-2_8-branch/lib/python/DateTime/DateTime.py 2005-05-25 12:38:22 UTC (rev 30495) @@ -1488,9 +1488,20 @@ tzdiff = _tzoffset(ltz, self._t) - _tzoffset(self._tz, self._t) zself = self + tzdiff/86400.0 microseconds = int((zself._second - zself._nearsec) * 100) -return datetime(zself._year, zself._month, zself._day, zself._hour, + +# Note: in older version strftime() accept also unicode strings +# as format strings (just because time.strftime() did not perform +# any type checking). So we convert unicode strings to utf8, +# pass them to strftime and convert them back to unicode if necessary + +format_is_unicode = False +if isinstance(format, unicode): +format = format.encode('utf-8') +format_is_unicode = True +ds = datetime(zself._year, zself._month, zself._day, zself._hour, zself._minute, int(zself._nearsec), microseconds).strftime(format) +return format_is_unicode and unicode(ds, 'utf-8') or ds # General formats from previous DateTime def Date(self): ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/lib/python/DateTime/DateTime.py strftime() accepts unicode strings again
Log message for revision 30494: strftime() accepts unicode strings again Changed: U Zope/trunk/lib/python/DateTime/DateTime.py -=- Modified: Zope/trunk/lib/python/DateTime/DateTime.py === --- Zope/trunk/lib/python/DateTime/DateTime.py 2005-05-24 21:47:17 UTC (rev 30493) +++ Zope/trunk/lib/python/DateTime/DateTime.py 2005-05-25 12:36:25 UTC (rev 30494) @@ -1488,10 +1488,22 @@ tzdiff = _tzoffset(ltz, self._t) - _tzoffset(self._tz, self._t) zself = self + tzdiff/86400.0 microseconds = int((zself._second - zself._nearsec) * 100) -return datetime(zself._year, zself._month, zself._day, zself._hour, + +# Note: in older version strftime() accept also unicode strings +# as format strings (just because time.strftime() did not perform +# any type checking). So we convert unicode strings to utf8, +# pass them to strftime and convert them back to unicode if necessary + +format_is_unicode = False +if isinstance(format, unicode): +format = format.encode('utf-8') +format_is_unicode = True +ds = datetime(zself._year, zself._month, zself._day, zself._hour, zself._minute, int(zself._nearsec), microseconds).strftime(format) +return format_is_unicode and unicode(ds, 'utf-8') or ds + # General formats from previous DateTime def Date(self): """Return the date string for the object.""" ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins