skip to navigation
skip to content 3.5.0

Zope application programming interface


3.5.0 (2011-03-01)

  • Removed BBB imports of deprecated parts (services, multiviews etc.) which were removed in zope.component 3.6, thus requiring at least this version.
  • Using Python’s doctest module instead of depreacted zope.testing.doctest.

3.4.1 (2009-07-23)

  • Explicitely list all dependencies. Fixes test failures.

3.4.0 (2007-10-03)

  • Initial public release as an individual package.

Zope Application Programming Interface

This package provides a collection of commonly used APIs to make imports simpler.

Mostly, the APIs provided here are imported from elsewhere. A few are provided here.


The principals method returns the authentication service. If no service is defined, a ComponentLookupError is raised:

>>> from import zapi
>>> zapi.principals() #doctest: +NORMALIZE_WHITESPACE
Traceback (most recent call last):
(<InterfaceClass zope.authentication.interfaces.IAuthentication>, '')

But if we provide an authentication service:

>>> import zope.interface
>>> from zope.authentication.interfaces import IAuthentication
>>> class FakeAuthenticationUtility:
...     zope.interface.implements(IAuthentication)
>>> fake = FakeAuthenticationUtility()
>>> from import ztapi
>>> ztapi.provideUtility(IAuthentication, fake)

Then we should be able to get the service back when we ask for the principals:

>>> zapi.principals() is fake
File Type Py Version Uploaded on Size (md5) Source 2011-03-01 6KB