Package cherrypy :: Module _cpconfig :: Class NamespaceSet
[hide private]
[frames] | no frames]

Class NamespaceSet

source code

object --+    
         |    
      dict --+
             |
            NamespaceSet

A dict of config namespace names and handlers.

Each config entry should begin with a namespace name; the corresponding namespace handler will be called once for each config entry in that namespace, and will be passed two arguments: the config key (with the namespace removed) and the config value.

Namespace handlers may be any Python callable; they may also be Python 2.5-style 'context managers', in which case their __enter__ method should return a callable to be used as the handler. See cherrypy.tools (the Toolbox class) for an example.

Instance Methods [hide private]
 
__call__(self, config)
Iterate through config and pass it to each namespace handler.
source code
 
__repr__(self)
repr(x)
source code
a shallow copy of D
__copy__(self) source code
a shallow copy of D
copy(self) source code

Inherited from dict: __cmp__, __contains__, __delitem__, __eq__, __ge__, __getattribute__, __getitem__, __gt__, __hash__, __init__, __iter__, __le__, __len__, __lt__, __ne__, __new__, __setitem__, clear, fromkeys, get, has_key, items, iteritems, iterkeys, itervalues, keys, pop, popitem, setdefault, update, values

Inherited from object: __delattr__, __reduce__, __reduce_ex__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__call__(self, config)
(Call operator)

source code 

Iterate through config and pass it to each namespace handler.

'config' should be a flat dict, where keys use dots to separate namespaces, and values are arbitrary.

The first name in each config key is used to look up the corresponding namespace handler. For example, a config entry of {'tools.gzip.on': v} will call the 'tools' namespace handler with the args: ('gzip.on', v)

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

copy(self)

source code 
Returns: a shallow copy of D
Overrides: dict.copy
(inherited documentation)