webob.multidict -- multi-value dictionary object — WebOb 1.7.4 documentation

# `webob.multidict` -- multi-value dictionary object

Gives a multi-value dictionary object (MultiDict) plus several wrappers

class `webob.multidict.` `MultiDict`(*args, **kw)

  An ordered dictionary that can have multiple values for each key. Adds the methods getall, getone, mixed and extend and add to the normal dictionary interface.

  `add`(key, value)

    Add the key and value, not overwriting any previous value.

  `dict_of_lists`()

    Returns a dictionary where each key is associated with a list of values.

  classmethod `from_fieldstorage`(fs)

    Create a dict from a cgi.FieldStorage instance

  `get`(k[, d]) → D[k] if k in D, else d. d defaults to None.
  `getall`(key)

    Return a list of all values matching the key (may be an empty list)

  `getone`(key)

    Get one value matching the key, raising a KeyError if multiple values were found.

  `mixed`()

    Returns a dictionary where the values are either single values, or a list of values when a key/value appears more than once in this dictionary. This is similar to the kind of dictionary often used to represent the variables in a web request.

  classmethod `view_list`(lst)

    Create a dict that is a view on the given list

class `webob.multidict.` `NestedMultiDict`(*dicts)

  Wraps several MultiDict objects, treating it as one large MultiDict

class `webob.multidict.` `NoVars`(reason=None)

  Represents no variables; used when no variables are applicable.

  This is read-only