OpenQuizz
Une application de gestion des contenus pédagogiques
|
Public Member Functions | |
def | __reduce_ex__ (self, protocol) |
def | __init__ (self, dicts=None) |
def | fromkeys (cls) |
def | __getitem__ (self, key) |
def | get (self, key, default=None, type=None) |
def | getlist (self, key, type=None) |
def | keys (self) |
def | items (self, multi=False) |
def | values (self) |
def | lists (self) |
def | listvalues (self) |
def | copy (self) |
def | to_dict (self, flat=True) |
def | __len__ (self) |
def | __contains__ (self, key) |
def | __repr__ (self) |
![]() | |
def | add (self, key, value) |
def | popitemlist (self) |
def | poplist (self, key) |
def | setlist (self, key, new_list) |
def | setlistdefault (self, key, default_list=None) |
![]() | |
def | fromkeys (cls, keys, value=None) |
def | __hash__ (self) |
def | setdefault (self, key, default=None) |
def | update (self, *args, **kwargs) |
def | pop (self, key, default=None) |
def | popitem (self) |
def | __setitem__ (self, key, value) |
def | __delitem__ (self, key) |
def | clear (self) |
![]() | |
def | __getstate__ (self) |
def | __setstate__ (self, value) |
def | __setitem__ (self, key, value) |
def | add (self, key, value) |
def | setlist (self, key, new_list) |
def | setdefault (self, key, default=None) |
def | setlistdefault (self, key, default_list=None) |
def | deepcopy (self, memo=None) |
def | update (self, other_dict) |
def | pop (self, key, default=_missing) |
def | popitem (self) |
def | poplist (self, key) |
def | popitemlist (self) |
def | __copy__ (self) |
def | __deepcopy__ (self, memo) |
Data Fields | |
dicts | |
Static Public Attributes | |
has_key | |
A read only :class:`MultiDict` that you can pass multiple :class:`MultiDict` 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 :exc:`~exceptions.BadRequest` HTTP exception and will render a page for a ``400 BAD REQUEST`` if caught in a catch-all for HTTP exceptions.
def __init__ | ( | self, | |
dicts = None |
|||
) |
Reimplemented from MultiDict.
def __contains__ | ( | self, | |
key | |||
) |
def __getitem__ | ( | self, | |
key | |||
) |
Return the first data value for this key; raises KeyError if not found. :param key: The key to be looked up. :raise KeyError: if the key does not exist.
Reimplemented from MultiDict.
def __len__ | ( | self | ) |
def __reduce_ex__ | ( | self, | |
protocol | |||
) |
Reimplemented from ImmutableMultiDictMixin.
def __repr__ | ( | self | ) |
Reimplemented from MultiDict.
def copy | ( | self | ) |
Return a shallow mutable copy of this object. This returns a :class:`MultiDict` representing the data at the time of copying. The copy will no longer reflect changes to the wrapped dicts. .. versionchanged:: 0.15 Return a mutable :class:`MultiDict`.
Reimplemented from MultiDict.
def fromkeys | ( | cls | ) |
def get | ( | self, | |
key, | |||
default = None , |
|||
type = None |
|||
) |
Return the default value if the requested data doesn't exist. If `type` is provided and is a callable it should convert the value, return it or raise a :exc:`ValueError` if that is not possible. In this case the function will return the default as if the value was not found: >>> d = TypeConversionDict(foo='42', bar='blub') >>> d.get('foo', type=int) 42 >>> d.get('bar', -1, type=int) -1 :param key: The key to be looked up. :param default: The default value to be returned if the key can't be looked up. If not further specified `None` is returned. :param type: A callable that is used to cast the value in the :class:`MultiDict`. If a :exc:`ValueError` is raised by this callable the default value is returned.
Reimplemented from TypeConversionDict.
def getlist | ( | self, | |
key, | |||
type = None |
|||
) |
Return the list of items for a given key. If that key is not in the `MultiDict`, the return value will be an empty list. Just as `get` `getlist` accepts a `type` parameter. All items will be converted with the callable defined there. :param key: The key to be looked up. :param type: A callable that is used to cast the value in the :class:`MultiDict`. If a :exc:`ValueError` is raised by this callable the value will be removed from the list. :return: a :class:`list` of all the values for the key.
Reimplemented from MultiDict.
def items | ( | self, | |
multi = False |
|||
) |
Return an iterator of ``(key, value)`` pairs. :param multi: If set to `True` the iterator returned will have a pair for each value of each key. Otherwise it will only contain pairs for the first value of each key.
Reimplemented from MultiDict.
def keys | ( | self | ) |
Reimplemented from MultiDict.
def lists | ( | self | ) |
Return a iterator of ``(key, values)`` pairs, where values is the list of all values associated with the key.
Reimplemented from MultiDict.
def listvalues | ( | self | ) |
Return an iterator of all values associated with a key. Zipping :meth:`keys` and this is the same as calling :meth:`lists`: >>> d = MultiDict({"foo": [1, 2, 3]}) >>> zip(d.keys(), d.listvalues()) == d.lists() True
Reimplemented from MultiDict.
def to_dict | ( | self, | |
flat = True |
|||
) |
Return the contents as regular dict. If `flat` is `True` the returned dict will only have the first item present, if `flat` is `False` all values will be returned as lists. :param flat: If set to `False` the dict returned will have lists with all the values in it. Otherwise it will only contain the first item for each key. :return: a :class:`dict`
Reimplemented from MultiDict.
def values | ( | self | ) |
Returns an iterator of the first value on every key's value list.
Reimplemented from MultiDict.
dicts |
|
static |