[Checkins] SVN: DateTime/trunk/ - Launchpad #142521: Removed confusing special case in

Jens Vagelpohl jens at dataflake.org
Tue Jul 27 13:07:43 EDT 2010


Log message for revision 115125:
  - Launchpad #142521: Removed confusing special case in
    DateTime.__str__ where DateTime instances for midnight   
    (e.g. '2010-07-27 00:00:00 US/Eastern') values would   
    render only their date and nothing else.
  

Changed:
  U   DateTime/trunk/CHANGES.txt
  U   DateTime/trunk/src/DateTime/DateTime.py
  U   DateTime/trunk/src/DateTime/DateTime.txt

-=-
Modified: DateTime/trunk/CHANGES.txt
===================================================================
--- DateTime/trunk/CHANGES.txt	2010-07-27 14:42:39 UTC (rev 115124)
+++ DateTime/trunk/CHANGES.txt	2010-07-27 17:07:42 UTC (rev 115125)
@@ -4,6 +4,10 @@
 2.12.5 (unreleased)
 -------------------
 
+- Launchpad #142521: Removed confusing special case in 
+  DateTime.__str__ where DateTime instances for midnight 
+  (e.g. '2010-07-27 00:00:00 US/Eastern') values would 
+  render only their date and nothing else.
 
 2.12.4 (2010-07-12)
 -------------------

Modified: DateTime/trunk/src/DateTime/DateTime.py
===================================================================
--- DateTime/trunk/src/DateTime/DateTime.py	2010-07-27 14:42:39 UTC (rev 115124)
+++ DateTime/trunk/src/DateTime/DateTime.py	2010-07-27 17:07:42 UTC (rev 115125)
@@ -1676,10 +1676,7 @@
         """Convert a DateTime to a string."""
         y,m,d = self._year,self._month,self._day
         h,mn,s,t = self._hour,self._minute,self._second,self._tz
-        if h == mn == s == 0:
-            # hh:mm:ss all zero -- suppress the time.
-            return '%4.4d/%2.2d/%2.2d' % (y, m, d)
-        elif s == int(s):
+        if s == int(s):
             # A whole number of seconds -- suppress milliseconds.
             return '%4.4d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d %s' % (
                     y, m, d, h, mn, s, t)

Modified: DateTime/trunk/src/DateTime/DateTime.txt
===================================================================
--- DateTime/trunk/src/DateTime/DateTime.txt	2010-07-27 14:42:39 UTC (rev 115124)
+++ DateTime/trunk/src/DateTime/DateTime.txt	2010-07-27 17:07:42 UTC (rev 115125)
@@ -314,7 +314,7 @@
     the current object's day, in the object's timezone context:
 
     >>> dt.earliestTime()
-    DateTime('1997/03/09')
+    DateTime('1997/03/09 00:00:00 US/Eastern')
 
 * ``latestTime()`` return a new DateTime object that represents the
   latest possible time (in whole seconds) that still falls within the



More information about the checkins mailing list