werkzeug.CombinedMultiDict
¶
-
class
werkzeug.
CombinedMultiDict
(dicts=None)[source]¶ A read only
MultiDict
that you can pass multipleMultiDict
instances as sequence and it will combine the return values of all wrapped dicts:>>> from werkzeug.datastructures import CombinedMultiDict, MultiDict >>> post = MultiDict([('foo', 'bar')]) >>> get = MultiDict([('blub', 'blah')]) >>> combined = CombinedMultiDict([get, post]) >>> combined['foo'] 'bar' >>> combined['blub'] 'blah'
This works for all read operations and will raise a TypeError for methods that usually change data which isn’t possible.
From Werkzeug 0.3 onwards, the KeyError raised by this class is also a subclass of the
BadRequest
HTTP exception and will render a page for a400 BAD REQUEST
if caught in a catch-all for HTTP exceptions.
Methods¶
__init__ ([dicts]) |
|
add (key, value) |
|
clear () |
|
copy () |
Return a shallow copy of this object. |
deepcopy ([memo]) |
Return a deep copy of this object. |
fromkeys () |
|
get (key[, default, type]) |
|
getlist (key[, type]) |
|
has_key (key) |
|
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]) |
|
setlist (key, new_list) |
|
setlistdefault (key[, default_list]) |
|
to_dict ([flat]) |
Return the contents as regular dict. |
update (*args, **kwargs) |
|
values (*a, **kw) |
Like itervalues() , but returns a list. |
viewitems (...) |
|
viewkeys (...) |
|
viewvalues (...) |