apptools.naming.context module¶
The base class for all naming contexts.
- class apptools.naming.context.Context[source]¶
Bases:
HasTraits
The base class for all naming contexts.
- INITIAL_CONTEXT_FACTORY = 'apptools.naming.factory.initial'¶
- OBJECT_FACTORIES = 'apptools.naming.factory.object'¶
- STATE_FACTORIES = 'apptools.naming.factory.state'¶
- bind(name, obj, make_contexts=False)[source]¶
Binds a name to an object.
If ‘make_contexts’ is True then any missing intermediate contexts are created automatically.
- get_unique_name(prefix)[source]¶
Returns a name that is unique within the context.
The name returned will start with the specified prefix.
- lookup_context(name)[source]¶
Resolves a name relative to this context.
The name MUST resolve to a context.
- rebind(name, obj, make_contexts=False)[source]¶
Binds an object to a name that may already be bound.
If ‘make_contexts’ is True then any missing intermediate contexts are created automatically.
The object may be a different object but may also be the same object that is already bound to the specified name. The name may or may not be already used. Think of this as a safer version of ‘bind’ since this one will never raise an exception regarding a name being used.