{"id":23017,"library":"zope-browserresource","title":"zope.browserresource","description":"Implementation of browser resources for Zope, providing a way to publish static and dynamic resources over HTTP. Version 6.0 requires Python >=3.9 and is part of the Zope toolkit. Stable release cadence.","status":"active","version":"6.0","language":"python","source_language":"en","source_url":"https://github.com/zopefoundation/zope.browserresource/","tags":["zope","browser","resource","web","publishing"],"install":[{"cmd":"pip install zope.browserresource","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required for component architecture","package":"zope.component","optional":false},{"reason":"Required for interface definitions","package":"zope.interface","optional":false},{"reason":"Required for publishing browser resources","package":"zope.publisher","optional":false}],"imports":[{"note":"IResource is in the submodule interfaces, not top-level.","wrong":"from zope.browserresource import IResource","symbol":"IResource","correct":"from zope.browserresource.interfaces import IResource"},{"note":"Resource class is in the resource submodule, not top-level.","wrong":"from zope.browserresource import Resource","symbol":"Resource","correct":"from zope.browserresource.resource import Resource"}],"quickstart":{"code":"from zope.browserresource.resource import Resource\nfrom zope.browserresource.interfaces import IResource\nfrom zope.interface import implementer\n\n@implementer(IResource)\nclass MyResource(Resource):\n    def __init__(self, request):\n        self.request = request\n    def __call__(self):\n        return b\"Hello, world!\"","lang":"python","description":"Define a basic browser resource that returns a simple response."},"warnings":[{"fix":"Change import: from zope.browserresource.browserresource import Resource → from zope.browserresource.resource import Resource","message":"In version 5.x, the resource base class was in zope.browserresource.browserresource; in version 6.x it is in zope.browserresource.resource.","severity":"breaking","affected_versions":"5.x to 6.0"},{"fix":"Explicitly implement zope.publisher.interfaces.IBrowserPublisher if you need custom publication.","message":"IResource interface no longer directly inherits from IBrowserPublisher; use separate publication directives if needed.","severity":"deprecated","affected_versions":">=6.0"},{"fix":"Use zope.component registration: <adapter factory=\"...\" provides=\"zope.browserresource.interfaces.IResource\" for=\"zope.publisher.interfaces.IBrowserRequest\" name=\"myresource\" />","message":"Resource instances must be registered as named adapters (from IBrowserRequest to IResource) to be usable in Zope's traversal.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use: from zope.browserresource.resource import Resource","cause":"Resource is not exposed at package level; must be imported from submodule.","error":"ImportError: cannot import name 'Resource' from 'zope.browserresource'"},{"fix":"Instantiate with request: MyResource(request) or register as adapter and let Zope provide the request.","cause":"Resource.__init__ requires a request argument when called directly without adapter.","error":"TypeError: __init__() missing 1 required positional argument: 'request'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}