datastructures Module

class restkit.datastructures.MultiDict(*args, **kw)

Bases: UserDict.DictMixin

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.

clear()
copy()
dict_of_lists()

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

extend(other=None, **kwargs)
classmethod from_fieldstorage(fs)

Create a dict from a cgi.FieldStorage instance

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.

has_key(key)
iget(key)

like get but case insensitive

ipop(key, *args)

like pop but case insensitive

items()
iteritems()
iterkeys()
itervalues()
keys()
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.

pop(key, *args)
popitem()
setdefault(key, default=None)
values()