1

I know, it's a naive question :-)

Originally poped up into my mind over Zope 2: How to properly “browser:page” to make a page available everywhere?

4

1 回答 1

1

Views are callable adapters that provide output based on the context and the request.

Templates are callables that render a piece of text based on a template. They are often used in views.

Note that views can return text without using a template:

from zope.publisher.browser import BrowserView

class MyView(BrowserView):
    def __call__(self):
        return "Hello world, I am located at {0}".format(self.context.absolute_url())

Views can also be used by other Zope code, without themselves being published. Zope code uses a lot of views internally.

于 2013-01-08T13:01:21.563 回答