[Python-bugs-list] [ python-Bugs-747320 ] rfc2822 formatdate functionality duplication

SourceForge.net noreply at sourceforge.net
Wed Aug 20 02:31:21 EDT 2003


Bugs item #747320, was opened at 2003-06-01 21:18
Message generated for change (Comment added) made by gaul
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=747320&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Andrew Dalke (dalke)
Assigned to: Nobody/Anonymous (nobody)
Summary: rfc2822 formatdate functionality duplication

Initial Comment:
There are at least 4 places in the standard Python 2.3 library which 
build an RFC 2822 formatted string:

rfc822.formatstring
email.Utils.formatdate
logging.handlers.SMTPHandler.date_time
BaseHTTPServer.HTTPServer.date_time_string

Looking at them, it makes sense to me to
  - replace rfc822's implementation with email's
      (that's the most flexible of the bunch)

  - start a migration so that email uses the one
      from rfc822, if available, else it's own implementation
      (since email is distributed to older Pythons)

  - have logging use the one in rfc822.

  - have BaseHTTPServer use the one in rfc822

If this is deemed an appropriate change, I can send in
a patch.

----------------------------------------------------------------------

Comment By: Andrew Gaul (gaul)
Date: 2003-08-20 00:31

Message:
Logged In: YES 
user_id=139865

Careful, date/time formats differ between RFCs.

RFC 850  = Wdy, DD-Mon-YYYY HH:MM:SS (UT/GMT/(+/-)DDDD/...)
RFC 2616 = Wdy, DD Mon YYYY HH:MM:SS GMT
RFC 2822 = Wdy, DD Mon YYYY HH:MM:SS (+/-)DDDD

rfc822.formatstring
    deprecated; let it rot
email.Utils.formatdate
    uses RFC 2822, the One True Date Format
logging.handlers.SMTPHandler.date_time
    uses RFC 2616, should be using RFC 2822
BaseHTTPServer.HTTPServer.date_time_string
    uses RFC 2616
Cookie._getdate
    uses RFC 850

Patch 791776 changes SMTPHandler to use rfc2822.formatdate.
 grepping for day names, month names, year, gmtime, and
localtime does not reveal further duplication.

----------------------------------------------------------------------

Comment By: Barry A. Warsaw (bwarsaw)
Date: 2003-06-02 04:37

Message:
Logged In: YES 
user_id=12800

Personally, I'd like to see the email package's date formatting (and other 
email related tasks) be the canonical standard, and for other modules to use 
its rules when appropriate.

----------------------------------------------------------------------

Comment By: Anthony Baxter (anthonybaxter)
Date: 2003-06-01 22:13

Message:
Logged In: YES 
user_id=29957

It's not just formatdate - various email formatting tasks
are probably the
single largest source of duplication in the std library...



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=747320&group_id=5470



More information about the Python-bugs-list mailing list