werkzeug.OrderedMultiDict¶
-
class
werkzeug.OrderedMultiDict(mapping=None)[source]¶ Works like a regular
MultiDictbut preserves the order of the fields. To convert the ordered multi dict into a list you can use theitems()method and pass itmulti=True.In general an
OrderedMultiDictis an order of magnitude slower than aMultiDict.note
Due to a limitation in Python you cannot convert an ordered multi dict into a regular dict by using
dict(multidict). Instead you have to use theto_dict()method, otherwise the internal bucket objects are exposed.
Methods¶
__init__([mapping]) |
|
add(key, value) |
|
clear(() -> None. Remove all items from D.) |
|
copy() |
Return a shallow copy of this object. |
deepcopy([memo]) |
Return a deep copy of this object. |
fromkeys(...) |
v defaults to None. |
get(key[, default, type]) |
Return the default value if the requested data doesn’t exist. |
getlist(key[, type]) |
|
has_key((k) -> True if D has a key k, else False) |
|
items(*a, **kw) |
Like iteritems(), but returns a list. |
iteritems([multi]) |
|
iterkeys() |
|
iterlists() |
|
iterlistvalues() |
|
itervalues() |
|
keys(*a, **kw) |
Like iterkeys(), but returns a list. |
lists(*a, **kw) |
Like iterlists(), but returns a list. |
listvalues(*a, **kw) |
Like iterlistvalues(), but returns a list. |
pop(key[, default]) |
|
popitem() |
|
popitemlist() |
|
poplist(key) |
|
setdefault(key[, default]) |
Returns the value for the key if it is in the dict, otherwise it returns default and sets that value for key. |
setlist(key, new_list) |
|
setlistdefault(key[, default_list]) |
|
to_dict([flat]) |
Return the contents as regular dict. |
update(mapping) |
|
values(*a, **kw) |
Like itervalues(), but returns a list. |
viewitems(...) |
|
viewkeys(...) |
|
viewvalues(...) |