This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: rfc822.Message.get() incompatibility
Type: Stage:
Components: Documentation Versions: Python 2.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: fdrake Nosy List: arigo, fdrake, gvanrossum, kajiyama
Priority: normal Keywords:

Created on 2002-05-20 07:37 by kajiyama, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Messages (5)
msg10873 - (view) Author: KAJIYAMA, Tamito (kajiyama) Date: 2002-05-20 07:37
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.
msg10874 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-06-05 18:58
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.
msg10875 - (view) Author: Armin Rigo (arigo) * (Python committer) Date: 2002-10-08 09:30
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
msg10876 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-10-08 14:26
Logged In: YES 
user_id=6380

Reopened and assigned to Fred for doc bug.

(Armin: you can't attach files to an issue created by
someone else -- unless you're a project admin.)
msg10877 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2002-10-09 22:34
Logged In: YES 
user_id=3066

Committed Armin's patch and adjusted some nearby markup in
Doc/lib/librfc822.tex 1.43 and 1.38.14.4.
History
Date User Action Args
2022-04-10 16:05:20adminsetgithub: 36621
2002-05-20 07:37:49kajiyamacreate