4

Given that Products.Five is an integration layer to make the Zope Component Architecture (ZCA) usable in Plone:

  • Is it possible to use zope.publisher.browser in Plone or do I have to use Products.Five.browser to import BrowserView?

The former produces a traceback:

2015-06-04 14:47:02 ERROR Zope.SiteErrorLog 1433443622.720.549321919726 http://localhost:8080/Plone/@@hello Traceback (innermost last): Module ZPublisher.Publish, line 138, in publish Module ZPublisher.mapply, line 77, in mapply Module ZPublisher.Publish, line 48, in call_object Module zope.publisher.browser, line 968, in __call__ NotImplementedError: Subclasses should override __call__ to provide a response body

Whereas the latter "just works"

aclark
  • 4,345
  • 1
  • 19
  • 31
  • 2
    Who is down voting this and why? Please don't down vote without including a constructive comment. Thanks – aclark Jun 04 '15 at 19:18

1 Answers1

4

You need to use Products.Five.browser.BrowserView because it is in charge of plugging the view in Acquisition, hence (among others) in Zope 2 security infrastructure.

It inherits from AcquisitionBBB.

Zope 2 security relies on acquisition to configure permissions only at root of content trees.

  • 1
    Confusingly, I am using zope.publisher.browser.BrowserPage here: http://stackoverflow.com/a/23779925/185820. That's confusing on two levels: 1.) What's the difference between BrowserView and BrowserPage and why do we need two similar classes in zope.publisher? And 2.) Why can I successfully use BrowserPage but not BrowserView? – aclark Jun 06 '15 at 14:29
  • 2
    My answer above tells why you should use `Five.BrowserView`, not why your example fails. I guess that in the example above you registered a zcml `browser:view` with class `zope.publisher.browser.BrowserPage`. However Zope 2 publisher demands a class that defines `__call__` method. – Godefroid Chapelle Jun 06 '15 at 15:40
  • 2
    In the example you point to, you neither make any security check, neither need to access any other content object through Acquisition. IOW, it does not need a `Five.brower.BrowserView`. – Godefroid Chapelle Jun 06 '15 at 15:55