[top] / zope / app / zapi / interfaces / IZAPI
Convenience API for use with Zope applications.
There are no attributes or fields specified.
traverse(object, path, default=None, request=None)
Traverse path
relative to the given object.
path
is a string with path segments separated by /
.
request
is passed in when traversing from presentation code. This
allows paths like @@foo to work.
Raises TraversalError if path cannot be found
Note: calling traverse with a path argument taken from an untrusted source, such as an HTTP request form variable, is a bad idea. It could allow a maliciously constructed request to call code unexpectedly. Consider using traverseName instead.
getUtility(interface, name='', context=None)
Get the utility that provides interface
Returns the nearest utility to the context that implements the specified interface. If one is not found, raises ComponentLookupError.
isinstance(object, cls)
Test whether an object is an instance of the given type
This function is useful because it works even if the instance is security proxied.
getAllUtilitiesRegisteredFor(interface, context=None)
Return all registered utilities for an interface
This includes overridden utilities.
An iterable of utility instances is returned. No names are returned.
absoluteURL(ob, request)
Compute the absolute URL of an object
getMultiAdapter(objects, interface=<InterfaceClass zope.interface.Interface>, name='', context=None)
Look for a multi-adapter to an interface for an objects
Returns a multi-adapter that can adapt objects to interface. If a matching adapter cannot be found, raises ComponentLookupError.
If context is None, an application-defined policy is used to choose
an appropriate service manager from which to get an Adapters
service.
If context
is not None, context is adapted to IServiceService,
and this adapter's Adapters
service is used.
The name consisting of an empty string is reserved for unnamed adapters. The unnamed adapter methods will often call the named adapter methods with an empty string for a name.
getFactoriesFor(interface, context=None)
Return a tuple (name, factory) of registered factories that create objects which implement the given interface.
getName(obj)
Get the name an object was traversed via
getPath(obj)
Returns a string representing the physical path to the object.
traverseName(obj, name, default=None, traversable=None, request=None)
Traverse a single step name
relative to the given object.
name
must be a string. '. and
..' are treated specially, as well as
names starting with @
or +
. Otherwise name
will be treated as a
single path segment.
You can explicitly pass in an ITraversable as the
traversable
argument. If you do not, the given object will
be adapted to ITraversable.
request
is passed in when traversing from presentation code. This
allows paths like @@foo to work.
Raises TraversalError if path cannot be found and default
was
not provided.
queryAdapter(object, interface=<InterfaceClass zope.interface.Interface>, name=u'', default=None, context=None)
Look for a named adapter to an interface for an object
Returns an adapter that can adapt object to interface. If a matching adapter cannot be found, returns the default.
If context is None, an application-defined policy is used to choose
an appropriate service manager from which to get an Adapters
service.
If context
is not None, context is adapted to IServiceService,
and this adapter's Adapters
service is used.
canonicalPath(path_or_object)
Returns a canonical absolute unicode path for the path or object.
Resolves segments that are '. or
..'.
Raises ValueError if a badly formed path is given.
principals()
Return the authentication utility
getParents(obj)
Returns a list starting with the given object's parent followed by each of its parents.
Raises a TypeError if the context doesn't go all the way down to a containment root.
getDefaultViewName(object, request, context=None)
Get the name of the default view for the object and request.
The request must implement IPresentationRequest, and provides the desired view type. The nearest one to the object is found. If a matching default view name cannot be found, raises ComponentLookupError.
If context is not specified, attempts to use object to specify a context.
queryUtility(interface, name='', default=None, context=None)
Look for the utility that provides interface
Returns the nearest utility to the context that implements the specified interface. If one is not found, returns default.
queryDefaultViewName(object, request, default=None, context=None)
Look for the name of the default view for the object and request.
The request must implement IPresentationRequest, and provides the desired view type. The nearest one to the object is found. If a matching default view name cannot be found, returns the default.
If context is not specified, attempts to use object to specify a context.
getAdapterInContext(object, interface, context)
Get a special adapter to an interface for an object
NOTE: This method should only be used if a custom context needs to be provided to provide custom component lookup. Otherwise, call the interface, as in:
interface(object)
Returns an adapter that can adapt object to interface. If a matching adapter cannot be found, raises ComponentLookupError.
Context is adapted to IServiceService, and this adapter's
Adapters
service is used.
If the object has a __conform__ method, this method will be called with the requested interface. If the method returns a non-None value, that value will be returned. Otherwise, if the object already implements the interface, the object will be returned.
handle(*objects)
Call all of the handlers for the given objects
Handlers are subscription adapter factories that don't produce anything. They do all of their work when called. Handlers are typically used to handle events.
queryMultiAdapter(objects, interface=<InterfaceClass zope.interface.Interface>, name=u'', default=None, context=None)
Look for a multi-adapter to an interface for objects
Returns a multi-adapter that can adapt objects to interface. If a matching adapter cannot be found, returns the default.
If context is None, an application-defined policy is used to choose
an appropriate service manager from which to get an Adapters
service.
If context
is not None, context is adapted to IServiceService,
and this adapter's Adapters
service is used.
The name consisting of an empty string is reserved for unnamed adapters. The unnamed adapter methods will often call the named adapter methods with an empty string for a name.
getGlobalSiteManager()
Return the global site manager.
This function should never fail and always return an object that provides `IGlobalSiteManager`.
getAdapters(objects, provided, context=None)
Look for all matching adapters to a provided interface for objects
Return a list of adapters that match. If an adapter is named, only the most specific adapter of a given name is returned.
If context is None, an application-defined policy is used to choose
an appropriate service manager from which to get an Adapters
service.
If context
is not None, context is adapted to IServiceService,
and this adapter's Adapters
service is used.
queryAdapterInContext(object, interface, context, default=None)
Look for a special adapter to an interface for an object
NOTE: This method should only be used if a custom context needs to be provided to provide custom component lookup. Otherwise, call the interface, as in:
interface(object, default)
Returns an adapter that can adapt object to interface. If a matching adapter cannot be found, returns the default.
Context is adapted to IServiceService, and this adapter's
Adapters
service is used.
If the object has a __conform__ method, this method will be called with the requested interface. If the method returns a non-None value, that value will be returned. Otherwise, if the object already implements the interface, the object will be returned.
getUtilitiesFor(interface, context=None)
Return the utilities that provide an interface
An iterable of utility name-value pairs is returned.
joinPath(path, *args)
Join the given relative paths to the given path.
Returns a unicode path.
The path should be well-formed, and not end in a /
unless it is
the root path. It can be either a string (ascii only) or unicode.
The positional arguments are relative paths to be added to the
path as new path segments. The path may be absolute or relative.
A segment may not start with a '/ because that would be confused
with an absolute path. A segment may not end with a
/ because we
do not allow
/ at the end of relative paths. A segment may
consist of . or .. to mean "the same place", or "the parent path"
respectively. A
. should be removed and a
.. should cause the
segment to the left to be removed. joinPath(
/', ..
) should
raise an exception.
subscribers(required, provided, context=None)
Get subscribers
Subscribers are returned that provide the provided interface and that depend on and are computed from the sequence of required objects.
If context is None, an application-defined policy is used to choose
an appropriate service manager from which to get an Adapters
service.
If context
is not None, context is adapted to IServiceService,
and this adapter's Adapters
service is used.
getAdapter(object, interface=<InterfaceClass zope.interface.Interface>, name=u'', context=None)
Get a named adapter to an interface for an object
Returns an adapter that can adapt object to interface. If a matching adapter cannot be found, raises ComponentLookupError.
If context is None, an application-defined policy is used to choose
an appropriate service manager from which to get an Adapters
service.
If context
is not None, context is adapted to IServiceService,
and this adapter's Adapters
service is used.
name(obj)
Return an object's name
This is the name the object is stored under in the container it was accessed in. If the name is unknown, None is returned.
UserError(*args)
Return an error message to a user.
The error is an exception to be raised.
The given args will be converted to strings and displayed in the message shown the user.
getRoot(obj)
Returns the root of the traversal for the given object.
adapts(*interfaces)
Declare that a class adapts the given interfaces.
This function can only be used in a class definition.
(TODO, allow classes to be passed as well as interfaces.)
getFactoryInterfaces(name, context=None)
Get interfaces implemented by a factory
Finds the factory of the given name that is nearest to the context, and returns the interface or interface tuple that object instances created by the named factory will implement.
createObject(factory_name, *args, **kwargs)
Create an object using a factory
Finds the named factory in the current site and calls it with the given arguments. If a matching factory cannot be found raises ComponentLookupError. Returns the created object.
A context keyword argument can be provided to cause the factory to be looked up in a location other than the current site. (Of course, this means that it is impossible to pass a keyword argument named "context" to the factory.
queryType(object, type)
Returns the interface implemented by object that provides type.
For example, if you have an Image, you often would like to know which interface is recognized as a Content Type interface (IContentType). So you would call queryType(myImage, IContentType) which would return IImage.
getSiteManager(context=None)
Get the nearest site manager in the given context.
If `context` is `None`, return the global site manager.
If the `context` is not `None`, it is expected that an adapter from the `context` to `IComponentLookup` can be found. If no adapter is found, a `ComponentLookupError` is raised.
getParent(obj)
Returns the container the object was traversed via.
Returns None if the object is a containment root. Raises TypeError if the object doesn't have enough context to get the parent.
There are no specific adapters registered for this interface.
There are no extended adapters registered for this interface.
zope.viewlet.metaconfigure.JavaScriptViewlet
(name: boston.js)
zope.viewlet.manager.<ViewletManager providing IJavaScript>
(name: zope.app.boston.IJavaScript)
zope.viewlet.viewlet.SimpleViewletClass from /opt/zope/sr/apidoc/src/zope/app/boston/viewlets/toolbar/viewlet.pt
(name: toolbar)
zope.traversing.namespace.lang
(name: lang)
zope.viewlet.manager.<ViewletManager providing ICSS>
(name: zope.app.boston.ICSS)
zope.traversing.namespace.acquire
(name: acquire)
zope.traversing.namespace.acquire
(name: acquire)
zope.traversing.namespace.acquire
(name: acquire)
zope.traversing.namespace.acquire
(name: acquire)
zope.app.apidoc.codemodule.browser.introspector.annotationsNamespace
(name: annotations)
zope.app.apidoc.codemodule.browser.introspector.annotationsNamespace
(name: annotations)
zope.app.apidoc.codemodule.browser.introspector.annotationsNamespace
(name: annotations)
zope.app.apidoc.codemodule.browser.introspector.annotationsNamespace
(name: annotations)
zope.viewlet.metaconfigure.CSSViewlet
(name: xmltree.css)
zope.app.pagetemplate.urlquote.URLQuote
(name: url)
zope.viewlet.viewlet.SimpleViewletClass from /opt/zope/sr/apidoc/src/zope/app/boston/viewlets/xmltree/xmltree.pt
(name: xmltree)
zope.viewlet.metaconfigure.CSSViewlet
(name: skin.css)
zope.app.preference.preference.preferencesNamespace
(name: preferences)
zope.app.preference.default.DefaultPreferences
(name: preferences)
zope.traversing.namespace.attr
(name: attribute)
zope.traversing.namespace.attr
(name: attribute)
zope.traversing.namespace.attr
(name: attribute)
zope.traversing.namespace.attr
(name: attribute)
zope.viewlet.manager.<ViewletManager providing IHead>
(name: zope.app.boston.IHead)
zope.app.component.back35.RegistrationManagerNamespace
(name: registrations)
zope.viewlet.manager.<ViewletManager providing ILeft>
(name: zope.app.boston.ILeft)
zope.traversing.namespace.resource
(name: resource)
zope.traversing.namespace.resource
(name: resource)
zope.traversing.namespace.resource
(name: resource)
zope.traversing.namespace.resource
(name: resource)
zope.traversing.namespace.etc
(name: etc)
zope.traversing.namespace.etc
(name: etc)
zope.traversing.namespace.etc
(name: etc)
zope.traversing.namespace.etc
(name: etc)
zope.traversing.namespace.etc
(name: etc)
zope.app.apidoc.apidoc.apidocNamespace
(name: apidoc)
zope.app.apidoc.apidoc.apidocNamespace
(name: apidoc)
zope.app.apidoc.apidoc.apidocNamespace
(name: apidoc)
zope.app.apidoc.apidoc.apidocNamespace
(name: apidoc)
zope.traversing.namespace.acquire
(name: acquire)
zope.traversing.namespace.lang
(name: lang)
zope.traversing.namespace.lang
(name: lang)
zope.traversing.namespace.lang
(name: lang)
zope.traversing.namespace.lang
(name: lang)
zope.traversing.namespace.item
(name: item)
zope.traversing.namespace.item
(name: item)
zope.traversing.namespace.item
(name: item)
zope.traversing.namespace.item
(name: item)
zope.traversing.namespace.item
(name: item)
zope.viewlet.metaconfigure.JavaScriptViewlet
(name: xmltree)
zope.viewlet.metaconfigure.CSSViewlet
(name: toolbar-css)
zope.traversing.namespace.adapter
(name: adapter)
zope.app.apidoc.apidoc.apidocNamespace
(name: apidoc)
zope.traversing.namespace.vh
(name: vh)
zope.traversing.namespace.vh
(name: vh)
zope.traversing.namespace.vh
(name: vh)
zope.traversing.namespace.vh
(name: vh)
zope.app.onlinehelp.helpNamespace
(name: help)
zope.app.onlinehelp.helpNamespace
(name: help)
zope.app.onlinehelp.helpNamespace
(name: help)
zope.app.onlinehelp.helpNamespace
(name: help)
zope.app.onlinehelp.helpNamespace
(name: help)
zope.traversing.namespace.adapter
(name: adapter)
zope.traversing.namespace.adapter
(name: adapter)
zope.traversing.namespace.adapter
(name: adapter)
zope.traversing.namespace.adapter
(name: adapter)
zope.traversing.namespace.debug
(name: debug)
zope.traversing.namespace.debug
(name: debug)
zope.traversing.namespace.debug
(name: debug)
zope.traversing.namespace.debug
(name: debug)
zope.app.pagetemplate.talesapi.ZopeTalesAPI
(name: zope)
zope.traversing.namespace.attr
(name: attribute)
zope.app.preference.preference.preferencesNamespace
(name: preferences)
zope.app.preference.preference.preferencesNamespace
(name: preferences)
zope.app.preference.preference.preferencesNamespace
(name: preferences)
zope.app.preference.preference.preferencesNamespace
(name: preferences)
zope.app.apidoc.codemodule.browser.introspector.annotationsNamespace
(name: annotations)
zope.traversing.namespace.view
(name: view)
zope.traversing.namespace.view
(name: view)
zope.traversing.namespace.view
(name: view)
zope.traversing.namespace.view
(name: view)
zope.formlib.namedtemplate.NamedTemplatePathAdapter
(name: template)
zope.viewlet.manager.<ViewletManager providing IToolBar>
(name: zope.app.boston.IToolBar)
zope.viewlet.metaconfigure.CSSViewlet
(name: widget.css)
There are no views available.
There are no views available.
There are no views available.
There are no views available.
There are no views available.
There are no views available.
There are no views available.
There are no views available.
There are no views available.
There are no views available.
There are no views available.
There are no views available.