]> granicus.if.org Git - python/commitdiff
The email module's parsedate_tz function now sets the daylight savings
authorAnthony Baxter <anthonybaxter@gmail.com>
Mon, 3 Apr 2006 08:05:07 +0000 (08:05 +0000)
committerAnthony Baxter <anthonybaxter@gmail.com>
Mon, 3 Apr 2006 08:05:07 +0000 (08:05 +0000)
flag to -1 (unknown) since it can't tell from the date whether it should
be set.
patch from Aldo Cortesi

Lib/email/_parseaddr.py
Lib/email/test/test_email.py
Lib/email/test/test_email_renamed.py
Misc/ACKS
Misc/NEWS

index 109ff5f7c773659a090f85c574b26a17f118b4a5..5821ddf09058d5a3261fe17c35df9535e2fbf93d 100644 (file)
@@ -124,7 +124,8 @@ def parsedate_tz(data):
         else:
             tzsign = 1
         tzoffset = tzsign * ( (tzoffset//100)*3600 + (tzoffset % 100)*60)
-    return yy, mm, dd, thh, tmm, tss, 0, 1, 0, tzoffset
+    # Daylight Saving Time flag is set to -1, since DST is unknown.
+    return yy, mm, dd, thh, tmm, tss, 0, 1, -1, tzoffset
 
 
 def parsedate(data):
index d35e770460092437c9169691c0b83bc5b17d7b78..d97769362be003d278f79c90d20a196c92e05390 100644 (file)
@@ -2113,12 +2113,12 @@ class TestMiscellaneous(TestEmailBase):
     def test_parsedate_no_dayofweek(self):
         eq = self.assertEqual
         eq(Utils.parsedate_tz('25 Feb 2003 13:47:26 -0800'),
-           (2003, 2, 25, 13, 47, 26, 0, 1, 0, -28800))
+           (2003, 2, 25, 13, 47, 26, 0, 1, -1, -28800))
 
     def test_parsedate_compact_no_dayofweek(self):
         eq = self.assertEqual
         eq(Utils.parsedate_tz('5 Feb 2003 13:47:26 -0800'),
-           (2003, 2, 5, 13, 47, 26, 0, 1, 0, -28800))
+           (2003, 2, 5, 13, 47, 26, 0, 1, -1, -28800))
 
     def test_parsedate_acceptable_to_time_functions(self):
         eq = self.assertEqual
index ed186a09dda2bb3297dbab2629271154490d850a..4ac2ee91da7284a9d69d48941e8e499cc540274c 100644 (file)
@@ -2119,12 +2119,12 @@ class TestMiscellaneous(TestEmailBase):
     def test_parsedate_no_dayofweek(self):
         eq = self.assertEqual
         eq(utils.parsedate_tz('25 Feb 2003 13:47:26 -0800'),
-           (2003, 2, 25, 13, 47, 26, 0, 1, 0, -28800))
+           (2003, 2, 25, 13, 47, 26, 0, 1, -1, -28800))
 
     def test_parsedate_compact_no_dayofweek(self):
         eq = self.assertEqual
         eq(utils.parsedate_tz('5 Feb 2003 13:47:26 -0800'),
-           (2003, 2, 5, 13, 47, 26, 0, 1, 0, -28800))
+           (2003, 2, 5, 13, 47, 26, 0, 1, -1, -28800))
 
     def test_parsedate_acceptable_to_time_functions(self):
         eq = self.assertEqual
index 12983c52ba215fc28d466b42ad9876523fc59ca1..04b6c77105cb0dd6f010a2c5ea303b6f1390304b 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -132,6 +132,7 @@ Jeffery Collins
 Matt Conway
 David M. Cooke
 Greg Copeland
+Aldo Cortesi
 David Costanzo
 Scott Cotton
 Greg Couch
index fa162f59c7ad5789f54f4b8e1a16bf86675a55a8..cb99814e04bef470fdf4383486f2c3ad4cd38a95 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -491,6 +491,10 @@ Extension Modules
 Library
 -------
 
+- The email module's parsedate_tz function now sets the daylight savings
+  flag to -1 (unknown) since it can't tell from the date whether it should
+  be set.
+
 - Patch #624325: urlparse.urlparse() and urlparse.urlsplit() results
   now sport attributes that provide access to the parts of the result.