Chris Withers wrote:
What's the difference between zope:view, browser:view, browser:page and browser:viewlet?

It's a mess. Here's the gist:

  Registers an adapter and optionally applies a permission to the
  interface that you're adapting to, e.g.::


  will cause the adapter's attributes as specified in IFoo to be
  protected with the 'foo.permission' (everything else will not be

  Registers an adapter and optionally applies a permission to all
  "allowed_attirbutes" or the "allowed_interface" if the "permission"
  parameter is given.

  Like zope:view, except:

    * the request type (second adapted object) defaults to

    * the "permission" always applies to 'publishTraverse',
      'browserDefault' and '__call__' attributes, in addition to the
      optionally specified "allowed_attributes" or "allowed_interface"

    * support sub-pages that will be available as

  Note: browser:view always creates new classes on the fly.

  Registers an adapter where the second adapted object defaults to
  IBrowserDefaltLayer. Always creates a new class on the fly and
  mixes in functionality that makes the adapter a *publishable view*.

  Registers an adapter for (context, request, view). It's out of
  scope here, I think.

I wish we could clean this up some day, but all my earlier attempts to walk this direction have mostly been shot down because people apparently hate deprecation warnings.

I'm sick of ZCML and its magic and its inconsistency. The typing and the pointy brackets I could live with... ME GROK SMASH ZCML.

I'm trying to register an adapter in such a way that I can do the following in a page template:

<p tal:content="structure someobj/@@render"/>

Which of the myriad flavours of view registration should I be using?

Inherit from BrowserView and use either a simple <adapter /> or a <view /> or a <browser:view /> directive to register it. Note that this thing won't be publishable via the URL then (which is probably what you want).

If you want it to be published, inherit from BrowserPage and use <browser:page />

Also, why, when zope:view is described as a synonym for zope:adapter, does zope:view support an allowed_attributes attribute, while zope:adapter does not?

zope:adapter assumes the "provides" interface as the "allowed_interface".

-- -- Professional Zope documentation and training
Zope3-dev mailing list

Reply via email to