[Python-bugs-list] [ python-Bugs-558179 ] rfc822.Message.get() incompatibility

noreply@sourceforge.net noreply@sourceforge.net
Tue, 08 Oct 2002 02:30:14 -0700


Bugs item #558179, was opened at 2002-05-20 07:37
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=558179&group_id=5470

Category: Python Library
Group: Python 2.2
Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: KAJIYAMA, Tamito (kajiyama)
Assigned to: Guido van Rossum (gvanrossum)
Summary: rfc822.Message.get() incompatibility

Initial Comment:
There is a backward incompatibility with Message.get()
in the standard rfc822 module.  I don't believe this 
incompatibility is intended to be introduced, so here
is a bug report.

In Python 2.2 and later, Message.get("foo") returns
an empty string if the header field "foo" is not
defined.  In older versions of Python, on the other
hand, it returns None.

In fact, the definition of the method is duplicated
in the Message class in in Python 2.2 and later, as
follows:

class Message:

    def getheader(self, name, default=None):
        ...
    get = getheader

    ...

    def get(self, name, default="")
        ...

A possible fix would be to omit the later definition.

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

Comment By: Armin Rigo (arigo)
Date: 2002-10-08 09:30

Message:
Logged In: YES 
user_id=4771

The documentation has not been completely updated.  The
default value returned by get() is said to be None at one
point and the empty string at a later point (when the
mapping interface of Message objects is discussed).  

Here is a patch (sorry, I cannot attach it -- no such field
in the SF interface??): 
http://arigo.tunes.org/librfc822-diff


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

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-06-05 18:58

Message:
Logged In: YES 
user_id=6380

You're so right.

I'll delete the "def get(...)" version both in the 2.2 branch and 
in the head of CVS.

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

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