[Python-checkins] python/dist/src/Doc/lib libdatetime.tex,1.26,1.27

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Thu, 02 Jan 2003 11:35:55 -0800


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv9800/Doc/lib

Modified Files:
	libdatetime.tex 
Log Message:
astimezone() internals:  if utcoffset() returns a duration, complain if
dst() returns None (instead of treating that as 0).


Index: libdatetime.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdatetime.tex,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** libdatetime.tex	1 Jan 2003 21:51:36 -0000	1.26
--- libdatetime.tex	2 Jan 2003 19:35:53 -0000	1.27
***************
*** 894,912 ****
      return CONSTANT + self.dst(dt)  # daylight-aware class
  \end{verbatim}
- \end{methoddesc}
  
! \begin{methoddesc}{tzname}{self, dt}
!   Return the timezone name corresponding to the \class{datetime} represented
!   by \var{dt}, as a string.  Nothing about string names is defined by the
!   \module{datetime} module, and there's no requirement that it mean anything
!   in particular.  For example, "GMT", "UTC", "-500", "-5:00", "EDT",
!   "US/Eastern", "America/New York" are all valid replies.  Return
!   \code{None} if a string name isn't known.  Note that this is a method
!   rather than a fixed string primarily because some \class{tzinfo} objects
!   will wish to return different names depending on the specific value
!   of \var{dt} passed, especially if the \class{tzinfo} class is
!   accounting for daylight time.
  \end{methoddesc}
  
  \begin{methoddesc}{dst}{self, dt}
    Return the daylight savings time (DST) adjustment, in minutes east of
--- 894,905 ----
      return CONSTANT + self.dst(dt)  # daylight-aware class
  \end{verbatim}
  
!     If \method{utcoffset()} does not return \code{None},
!     \method{dst()} should not return \code{None} either.
! 
! 
  \end{methoddesc}
  
+ 
  \begin{methoddesc}{dst}{self, dt}
    Return the daylight savings time (DST) adjustment, in minutes east of
***************
*** 938,941 ****
--- 931,947 ----
    ensure it.
  
+ \begin{methoddesc}{tzname}{self, dt}
+   Return the timezone name corresponding to the \class{datetime} represented
+   by \var{dt}, as a string.  Nothing about string names is defined by the
+   \module{datetime} module, and there's no requirement that it mean anything
+   in particular.  For example, "GMT", "UTC", "-500", "-5:00", "EDT",
+   "US/Eastern", "America/New York" are all valid replies.  Return
+   \code{None} if a string name isn't known.  Note that this is a method
+   rather than a fixed string primarily because some \class{tzinfo} objects
+   will wish to return different names depending on the specific value
+   of \var{dt} passed, especially if the \class{tzinfo} class is
+   accounting for daylight time.
+ \end{methoddesc}
+ 
  \end{methoddesc}
  
***************
*** 1380,1384 ****
  >>> from datetime import *
  >>> class TZ(tzinfo):
! ...     def utcoffset(self, dt): return -399
  ...
  >>> datetimetz(2002, 12, 25, tzinfo=TZ()).isoformat(' ')
--- 1386,1390 ----
  >>> from datetime import *
  >>> class TZ(tzinfo):
! ...     def utcoffset(self, dt): return timedelta(minutes=-399)
  ...
  >>> datetimetz(2002, 12, 25, tzinfo=TZ()).isoformat(' ')