Zope application programming interface
- 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.
- Explicitely list all dependencies. Fixes test failures.
- Initial public release as an individual package.
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 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 the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size zope.app.zapi-3.5.0.tar.gz (6.2 kB)||File type Source||Python version None||Upload date||Hashes View|