Traverse to another property namespace
Use this in .ini files (e.g. '__main__. = config.Namespace("environ.")')
to create a rule that looks up undefined properties in another property
namespace.
Or, use this as a way to treat a property namespace as a mapping object:
myNS = config.Namespace("some.prefix", aComponent)
myNS['spam.bayes'] # property 'some.prefix.spam.bayes'
myNS.get('something',default) # property 'some.prefix.something'
Or use this in a component class to allow traversing to a property space:
class MyClass(binding.Component):
appConfig = binding.Make(
config.Namespace('MyClass.conf')
)
something = binding.Obtain('appConfig/foo.bar.baz')
In the example above, something will be the component's value for the
property MyClass.conf.foo.bar.baz . Note that you may not traverse to
names beginning with an _ , and traversing to the name get will give you
the namespace's get method, not the get property in the namespace. To
obtain the get property, or properties beginning with _ , you must use
the mapping style of access, as shown above.
Methods
|
|
__call__
__getattr__
__getitem__
__init__
__repr__
get
keys
|
|
__call__
|
__call__ ( self, suffix )
Return a sub-namespace for suffix
|
|
__getattr__
|
__getattr__ ( self, attr )
|
|
__getitem__
|
__getitem__ ( self, key )
Return the value of property key within this namespace
|
|
__init__
|
__init__ (
self,
prefix,
target=NOT_GIVEN,
cacheAttrs=True,
)
|
|
__repr__
|
__repr__ ( self )
|
|
get
|
get (
self,
key,
default=None,
)
Return property key within this namespace, or default
|
|
keys
|
keys ( self )
|
|