Browser page
To create a page, which is an object that is published as a page, you need to provide an object that:
The BrowserPage base class provides a standard constructor and a simple implementation of IBrowserPublisher:
>>> class MyPage(BrowserPage): ... pass>>> request = TestRequest() >>> context = object() >>> page = MyPage(context, request)>>> from zope.publisher.interfaces.browser import IBrowserPublisher >>> IBrowserPublisher.providedBy(page) True>>> page.browserDefault(request) == (page, ()) True>>> page.publishTraverse(request, 'bob') # doctest: +ELLIPSIS Traceback (most recent call last): ... NotFound: Object: <zope.publisher.browser.MyPage object at ...>, name: 'bob'>>> page.request is request True>>> page.context is context True
But it doesn't supply a __call__ method:
>>> page() Traceback (most recent call last): ... NotImplementedError: Subclasses should override __call__ to provide a response body
It is the subclass' responsibility to do that.
There are no attributes in this class.
browserDefault(request)
publishTraverse(request, name)