[Zope3-checkins] CVS: Zope3/src/datetime - _datetime.py:1.26

Tim Peters tim.one@comcast.net
Wed, 22 Jan 2003 15:44:31 -0500


Update of /cvs-repository/Zope3/src/datetime
In directory cvs.zope.org:/tmp/cvs-serv22739/src/datetime

Modified Files:
	_datetime.py 
Log Message:
Added new test for fromutc(), and repaired a type-checking hole this
uncovered.


=== Zope3/src/datetime/_datetime.py 1.25 => 1.26 ===
--- Zope3/src/datetime/_datetime.py:1.25	Tue Jan 21 16:47:52 2003
+++ Zope3/src/datetime/_datetime.py	Wed Jan 22 15:43:59 2003
@@ -880,6 +880,8 @@
     def fromutc(self, dt):
         "datetime in UTC -> datetime in local time."
 
+        if not isinstance(dt, datetime):
+            raise TypeError("fromutc() requires a datetime argument")
         if dt.tzinfo is not self:
             raise ValueError("dt.tzinfo is not self")
 
@@ -892,7 +894,7 @@
         # explanation of this algorithm.
         dtdst = dt.dst()
         if dtdst is None:
-            raise ValueError("fromutc() requires a non_none dst() result")
+            raise ValueError("fromutc() requires a non-None dst() result")
         delta = dtoff - dtdst
         if delta:
             dt += delta