Log message for revision 79265:
  migrated some more methods 
  

Changed:
  U   
Zope/branches/ajung-DateTime-must-die-branch/lib/python/DateTime/DateTime.py

-=-
Modified: 
Zope/branches/ajung-DateTime-must-die-branch/lib/python/DateTime/DateTime.py
===================================================================
--- 
Zope/branches/ajung-DateTime-must-die-branch/lib/python/DateTime/DateTime.py    
    2007-08-25 15:32:02 UTC (rev 79264)
+++ 
Zope/branches/ajung-DateTime-must-die-branch/lib/python/DateTime/DateTime.py    
    2007-08-25 16:06:27 UTC (rev 79265)
@@ -1716,6 +1716,7 @@
 
         Dates are output as: YYYY-MM-DD HH:MM:SS
         """
+        # MIGRATED
         fmt = '%Y-%m-%d %H:%M:%S'
         return self._D.strftime(fmt)
 
@@ -1732,7 +1733,7 @@
         The HTML4 method below offers the same formatting, but converts
         to UTC before returning the value and sets the TZD "Z".
         """
-
+        #MIGRATED
         fmt = '%Y-%m-%dT%H:%M:%S'
 
         # ATT: Fix replace('Etc/',...)
@@ -1751,11 +1752,13 @@
            T, Z are literal characters.
            The time is in UTC.
         """
-        newdate = self.toZone('UTC')
-        return "%0.4d-%0.2d-%0.2dT%0.2d:%0.2d:%0.2dZ" % (
-            newdate._year, newdate._month, newdate._day,
-            newdate._hour, newdate._minute, newdate._second)
 
+        # MIGRATED
+        fmt = '%Y-%m-%dT%H:%M:%SZ'
+        utc_date = datetime(*self._D.utctimetuple()[:6])
+        return utc_date.strftime(fmt)
+
+
     def __add__(self,other):
         """A DateTime may be added to a number and a number may be
         added to a DateTime;  two DateTimes cannot be added.
@@ -1934,21 +1937,18 @@
 
         See: http://www.tondering.dk/claus/cal/node3.html#sec-calcjd
         """
-        a = (14 - self._month)/12 #integer division, discard remainder
-        y = self._year + 4800 - a
-        m = self._month + (12*a) - 3
-        return self._day + (153*m+2)/5 + 365*y + y/4 - y/100 + y/400 - 32045
 
+        # MIGRATED
+        a = (14 - self._D.month) / 12      #integer division, discard remainder
+        y = self._D.year + 4800 - a
+        m = self._D.month + (12 * a) - 3
+        return self._D.day + (153*m+2)/5 + 365*y + y/4 - y/100 + y/400 - 32045
+
     def week(self):
-        """Return the week number according to ISO.
+        """Return the week number according to ISO."""
+        # MIGRATED 
+        return self._D.isocalendar()[1]
 
-        See: 
http://www.tondering.dk/claus/cal/node6.html#SECTION00670000000000000000
-        """
-        J = self.JulianDay()
-        d4 = (J + 31741 - (J % 7)) % 146097 % 36524 % 1461
-        L = d4/1460
-        d1 = (( d4 - L) % 365) + L
-        return d1/7 + 1
 
     def encode(self, out):
         """Encode value for XML-RPC."""

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to