Back to index

moin  1.9.0~rc2
Public Member Functions
MoinMoin.support.werkzeug.datastructures.ImmutableTypeConversionDict Class Reference
Inheritance diagram for MoinMoin.support.werkzeug.datastructures.ImmutableTypeConversionDict:
Inheritance graph
[legend]
Collaboration diagram for MoinMoin.support.werkzeug.datastructures.ImmutableTypeConversionDict:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def copy
def __copy__
def setdefault
def update
def pop
def popitem
def __setitem__
def __delitem__
def clear
def get

Detailed Description

Works like a :class:`TypeConversionDict` but does not support
modifications.

.. versionadded:: 0.5

Definition at line 192 of file datastructures.py.


Member Function Documentation

Definition at line 206 of file datastructures.py.

00206 
00207     def __copy__(self):
00208         return self
00209 

Definition at line 102 of file datastructures.py.

00102 
00103     def __delitem__(self, key):
00104         is_immutable(self)

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.support.werkzeug.datastructures.ImmutableDictMixin.__setitem__ (   self,
  key,
  value 
) [inherited]

Definition at line 99 of file datastructures.py.

00099 
00100     def __setitem__(self, key, value):
00101         is_immutable(self)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 105 of file datastructures.py.

00105 
00106     def clear(self):
00107         is_immutable(self)
00108 

Here is the call graph for this function:

Return a shallow mutable copy of this object.  Keep in mind that
the standard library's :func:`copy` funciton is a no-op for this class
like for any other python immutable type (eg: :class:`tuple`).

Definition at line 199 of file datastructures.py.

00199 
00200     def copy(self):
00201         """Return a shallow mutable copy of this object.  Keep in mind that
00202         the standard library's :func:`copy` funciton is a no-op for this class
00203         like for any other python immutable type (eg: :class:`tuple`).
00204         """
00205         return TypeConversionDict(self)

Here is the caller graph for this function:

def MoinMoin.support.werkzeug.datastructures.TypeConversionDict.get (   self,
  key,
  default = None,
  type = None 
) [inherited]
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 in MoinMoin.support.werkzeug.datastructures.CombinedMultiDict.

Definition at line 162 of file datastructures.py.

00162 
00163     def get(self, key, default=None, type=None):
00164         """Return the default value if the requested data doesn't exist.
00165         If `type` is provided and is a callable it should convert the value,
00166         return it or raise a :exc:`ValueError` if that is not possible.  In
00167         this case the function will return the default as if the value was not
00168         found:
00169 
00170         >>> d = TypeConversionDict(foo='42', bar='blub')
00171         >>> d.get('foo', type=int)
00172         42
00173         >>> d.get('bar', -1, type=int)
00174         -1
00175 
00176         :param key: The key to be looked up.
00177         :param default: The default value to be returned if the key can't
00178                         be looked up.  If not further specified `None` is
00179                         returned.
00180         :param type: A callable that is used to cast the value in the
00181                      :class:`MultiDict`.  If a :exc:`ValueError` is raised
00182                      by this callable the default value is returned.
00183         """
00184         try:
00185             rv = self[key]
00186             if type is not None:
00187                 rv = type(rv)
00188         except (KeyError, ValueError):
00189             rv = default
00190         return rv
00191 

Here is the caller graph for this function:

def MoinMoin.support.werkzeug.datastructures.ImmutableDictMixin.pop (   self,
  key,
  default = None 
) [inherited]

Definition at line 93 of file datastructures.py.

00093 
00094     def pop(self, key, default=None):
00095         is_immutable(self)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 96 of file datastructures.py.

00096 
00097     def popitem(self):
00098         is_immutable(self)

Here is the call graph for this function:

def MoinMoin.support.werkzeug.datastructures.ImmutableDictMixin.setdefault (   self,
  key,
  default = None 
) [inherited]

Definition at line 87 of file datastructures.py.

00087 
00088     def setdefault(self, key, default=None):
00089         is_immutable(self)

Here is the call graph for this function:

def MoinMoin.support.werkzeug.datastructures.ImmutableDictMixin.update (   self,
  args,
  kwargs 
) [inherited]

Definition at line 90 of file datastructures.py.

00090 
00091     def update(self, *args, **kwargs):
00092         is_immutable(self)

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following file: