(self, key, val)
Adds a (name, value) pair, doesn't overwrite the value if it already
        exists.

        >>> headers = HTTPHeaderDict(foo='bar')
        >>> headers.add('Foo', 'baz')
        >>> headers['foo']
        'bar, baz'
Adds a (name, value) pair, doesn't overwrite the value if it already
        exists.
Adds a ( name value ) pair doesn t overwrite the value if it already exists .
def add(self, key, val):
        """Adds a (name, value) pair, doesn't overwrite the value if it already
        exists.

        >>> headers = HTTPHeaderDict(foo='bar')
        >>> headers.add('Foo', 'baz')
        >>> headers['foo']
        'bar, baz'
        """
        key_lower = key.lower()
        new_vals = key, val
        # Keep the common case aka no item present as fast as possible
        vals = self._container.setdefault(key_lower, new_vals)
        if new_vals is not vals:
            # new_vals was not inserted, as there was a previous one
            if isinstance(vals, list):
                # If already several items got inserted, we have a list
                vals.append(val)
            else:
                # vals should be a tuple then, i.e. only one item so far
                # Need to convert the tuple to list for further extension
                self._container[key_lower] = [vals[0], vals[1], val]
def add ( self , key , val ) : key_lower = key . lower ( ) new_vals = key , val # Keep the common case aka no item present as fast as possible vals = self . _container . setdefault ( key_lower , new_vals ) if new_vals is not vals : # new_vals was not inserted, as there was a previous one if isinstance ( vals , list ) : # If already several items got inserted, we have a list vals . append ( val ) else : # vals should be a tuple then, i.e. only one item so far # Need to convert the tuple to list for further extension self . _container [ key_lower ] = [ vals [ 0 ] , vals [ 1 ] , val ]