]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
get_all(): We never returned failobj if we found no matching headers.
authorBarry Warsaw <barry@python.org>
Tue, 9 Oct 2001 15:48:29 +0000 (15:48 +0000)
committerBarry Warsaw <barry@python.org>
Tue, 9 Oct 2001 15:48:29 +0000 (15:48 +0000)
Fix that, and also make the docstring describe failobj.

Lib/email/Message.py

index 512a0e91dc31c79bb445bf366ed07b7a2906b7bb..00efbcc0cf47b5f708095d4e5a22a604509a85b2 100644 (file)
@@ -227,12 +227,16 @@ class Message:
         These will be sorted in the order they appeared in the original
         message, and may contain duplicates.  Any fields deleted and
         re-inserted are alwyas appended to the header list.
+
+        If no such fields exist, failobj is returned (defaults to None).
         """
         values = []
         name = name.lower()
         for k, v in self._headers:
             if k.lower() == name:
                 values.append(v)
+        if not values:
+            return failobj
         return values
 
     def add_header(self, _name, _value, **_params):