Skip to main content

Zope application programming interface

Project description

CHANGES

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.

principals()

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

>>> from zope.app import zapi
>>> zapi.principals() #doctest: +NORMALIZE_WHITESPACE
Traceback (most recent call last):
...
ComponentLookupError:
(<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 zope.app.testing 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
True

Download

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zope.app.zapi-3.4.1.tar.gz (5.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page