[Python-checkins] python/dist/src/Lib/email _parseaddr.py,1.3,1.4

bwarsaw@users.sourceforge.net bwarsaw@users.sourceforge.net
Mon, 30 Dec 2002 09:21:38 -0800


Update of /cvsroot/python/python/dist/src/Lib/email
In directory sc8-pr-cvs1:/tmp/cvs-serv25069

Modified Files:
	_parseaddr.py 
Log Message:
parsedate_tz(): Fix SF bug #552345, optional FWS between the comma and
the day in an RFC 2822 date.


Index: _parseaddr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/_parseaddr.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** _parseaddr.py	30 Dec 2002 16:43:42 -0000	1.3
--- _parseaddr.py	30 Dec 2002 17:21:36 -0000	1.4
***************
*** 48,54 ****
      """
      data = data.split()
!     if data[0][-1] in (',', '.') or data[0].lower() in _daynames:
          # There's a dayname here. Skip it
          del data[0]
      if len(data) == 3: # RFC 850 date, deprecated
          stuff = data[0].split('-')
--- 48,61 ----
      """
      data = data.split()
!     # The FWS after the comma after the day-of-week is optional, so search and
!     # adjust for this.
!     if data[0].endswith(',') or data[0].lower() in _daynames:
          # There's a dayname here. Skip it
          del data[0]
+     else:
+         i = data[0].rfind(',')
+         if i < 0:
+             return None
+         data[0] = data[0][i+1:]
      if len(data) == 3: # RFC 850 date, deprecated
          stuff = data[0].split('-')