Zope Container (`zope.container`) is a foundational Python library within the Zope ecosystem, defining interfaces for object container components and providing concrete implementations like BTreeContainer and OrderedContainer. It serves as a building block for dynamic web applications and content management systems such as Plone, offering mechanisms for object persistence, integrity, and access control. Currently at version 7.2, the library maintains an active release cadence, frequently updating to support new Python versions and integrating changes from other Zope core packages.
pip install zope-containerVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates creating a basic BTreeContainer, implementing IContainer (a common pattern in Zope to declare interface adherence), and then adding and retrieving items. This showcases the core container functionality.
Upgrade your Python interpreter to a supported version or pin `zope-container` to an older version compatible with your Python environment. Refer to PyPI for specific version requirements.
Ensure your project's packaging and import mechanisms are compatible with PEP 420 namespace packages. This is typically handled automatically by modern Python packaging tools, but older setups might require adjustment.
Update code that declares interfaces or implementations to use the `@implementer` and `@provider` decorators from `zope.interface`. For example, replace `implements(IMyInterface)` with `@implementer(IMyInterface)`.
If working with very old code or migrating from it, update exception handling to catch `KeyError` and `ValueError` instead of the former `zope.exceptions` types.
Consult the `zope.container` changelog or the documentation for the specific Zope package that the module belongs to. For example, `IContained` moved to `zope.location.interfaces` in older versions.
Verify that all classes intended to implement `zope.container` interfaces (like `IContainer`, `IWriteContainer`) correctly use the `@implementer` decorator from `zope.interface` and that the object itself is registered or configured to be adaptable. Ensure `zope.interface` and other Zope packages are compatible versions.
Ensure that keys used for adding or accessing items in a container are unique and adhere to naming conventions (e.g., non-empty, valid string characters). Handle `KeyError` for non-existent items or `ValueError` for invalid names.
No dependency data recorded yet.