{"id":23016,"library":"zope.browserpage","title":"zope.browserpage","description":"Provides ZCML directives for configuring browser views and pages in Zope applications. Current version 6.0, requires Python >=3.9. Released under the Zope Foundation, maintained as part of the Zope Toolkit.","status":"active","version":"6.0","language":"python","source_language":"en","source_url":"https://github.com/zopefoundation/zope.browserpage","tags":["zope","browser","zcml","web","views"],"install":[{"cmd":"pip install zope.browserpage","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"zope.browser.browserpage was an older module; now BrowserPage lives in zope.browserpage","wrong":"from zope.browser.browserpage import BrowserPage","symbol":"BrowserPage","correct":"from zope.browserpage import BrowserPage"}],"quickstart":{"code":"import zope.browserpage\nfrom zope.browserpage import BrowserPage\n\nclass MyPage(BrowserPage):\n    def render(self):\n        return b\"<html><body>Hello</body></html>\"\n\n# Assuming you have a request object\n# page = MyPage(context, request)\n# print(page.render())","lang":"python","description":"Simple example of using BrowserPage directly."},"warnings":[{"fix":"Upgrade Python to 3.9 or later.","message":"zope.browserpage 6.0 dropped Python 2 support and requires Python >=3.9. Ensure your environment meets these requirements.","severity":"breaking","affected_versions":"6.0+"},{"fix":"Ensure the render method returns bytes (e.g., b\"content\" or \"content\".encode()).","message":"BrowserPage.render() must return bytes, not str. Returning a string will cause a TypeError.","severity":"gotcha","affected_versions":"all"},{"fix":"Use zope.browserpage directives in ZCML or consider using zope.browserresource for resources.","message":"ZCML-based configuration is the traditional approach, but many Zope projects are moving to Grok or direct configuration. New projects should consider alternatives.","severity":"deprecated","affected_versions":"6.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Convert the return value to bytes: return b\"...\" or return \"...\".encode()","cause":"BrowserPage.render() returns a string instead of bytes.","error":"TypeError: render() must return bytes, not str"},{"fix":"Change import to 'from zope.browserpage import BrowserPage'","cause":"Importing from the deprecated location.","error":"ModuleNotFoundError: No module named 'zope.browser.browserpage'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}