API functions and classes for the peak.naming package
Imported modules
|
|
from contexts import *
from interfaces import *
from names import *
from peak.api import NOT_GIVEN
from peak.binding.interfaces import IComponentFactory
from peak.util.imports import lazyModule
from protocols import adviseObject
import spi
from syntax import *
|
Functions
|
|
InitialContext
lookup
parseURL
|
|
InitialContext
|
InitialContext (
parent,
componentName=None,
**options,
)
Get an initial naming context, based on parent and keyword options
parent is the component which will be used as the naming context's
parent component, to obtain any required configuration data. The
componentName argument and options keyword arguments are used
to set up the context's name and attributes, just as with a normal
PEAK component constructor.
This function implements the binding.IComponentFactory interface, and
thus can be used as a factory for a binding.Make() attribute. That
is, you can do this:
myInitCtx = binding.Make(naming.InitialContext)
in a class to create a myInitCtx attribute. This can be useful if
you will be using naming functions a lot and would like to hang onto
an initial context.
|
|
lookup
|
lookup (
parent,
name,
default=NOT_GIVEN,
**options,
)
Look up name in the default initial context for parent , w/options
This is just a shortcut for calling:
naming.InitialContext(parent,**options)[name]
|
|
parseURL
|
parseURL (
parent,
name,
base=None,
)
Return a parsed URL for name , based on schemes available to parent
If a parser for the URL scheme isn't available, or name is not a
valid URL, exceptions.InvalidName will be raised. Note that name
must include a URL scheme, (e.g. "ldap:" ), or it will be considered
invalid, unless a valid base URL is supplied.
If a base is supplied, and name does not include a scheme, this
routine attempts to join name to the base URL, assuming that the
parser for the base URL supports this.
Exceptions
|
|
InvalidName( "Not a URL", name, base )
InvalidName( "Unknown scheme", scheme )
|
|
|