(self, key, value)
If a header with the given name already exists, the value is
        normally appended to the existing value separated by a comma.

        If, however, the already existing entry associated key with a
        value of type list (as is the case for "Set-Cookie"),
        the new value is appended to that list.
If a header with the given name already exists, the value is
        normally appended to the existing value separated by a comma.
If a header with the given name already exists the value is normally appended to the existing value separated by a comma .
def append(self, key, value):
        """
        If a header with the given name already exists, the value is
        normally appended to the existing value separated by a comma.

        If, however, the already existing entry associated key with a
        value of type list (as is the case for "Set-Cookie"),
        the new value is appended to that list.
        """
        if key not in self:
            if key.lower() == "set-cookie":
                self[key] = [value]
            else:
                self[key] = value
        else:
            if isinstance(self[key], list):
                self[key].append(value)
            else:
                self[key] = ", ".join([self[key], value])
def append ( self , key , value ) : if key not in self : if key . lower ( ) == "set-cookie" : self [ key ] = [ value ] else : self [ key ] = value else : if isinstance ( self [ key ] , list ) : self [ key ] . append ( value ) else : self [ key ] = ", " . join ( [ self [ key ] , value ] )