Skip to content

Commit

Permalink
[fc] Repository: plone.restapi
Browse files Browse the repository at this point in the history
Branch: refs/heads/main
Date: 2024-09-11T20:06:13-07:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: plone/plone.restapi@057c59a

Fix error getting allow_discussion  when p.a.discussion is not activated. (#1808)

* Fix error getting allow_discussion value when p.a.discussion is not activated.

This fixes an error in Plone 6.1 when the `plone.app.discussion` package is available but not activated in the Add-ons.
Problem is that the `conversation_view` is only defined when the browser layer of `plone.app.discussion` is found.
Sample error:

```
Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 181, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 391, in publish_module
  Module ZPublisher.WSGIPublisher, line 285, in publish
  Module ZPublisher.mapply, line 98, in mapply
  Module ZPublisher.WSGIPublisher, line 68, in call_object
  Module plone.rest.service, line 21, in __call__
  Module plone.restapi.services, line 19, in render
  Module plone.restapi.services.content.get, line 16, in reply
  Module plone.restapi.serializer.dxcontent, line 179, in __call__
  Module plone.restapi.serializer.dxcontent, line 142, in __call__
  Module plone.restapi.serializer.dxcontent, line 48, in get_allow_discussion_value
  Module zope.component._api, line 113, in getMultiAdapter
zope.interface.interfaces.ComponentLookupError:
((&lt;FolderishDocument at /PloneVolto/page&gt;,
  &lt;WSGIRequest, URL=http://localhost:8080/PloneVolto/++api++/page/GET_application_json_&gt;),
 &lt;InterfaceClass zope.interface.Interface&gt;, 'conversation_view')
```

* Fix tests: Plone Site now gets allow_discussion false instead of null.

Files changed:
A news/1808.bugfix
M src/plone/restapi/serializer/dxcontent.py
M src/plone/restapi/tests/http-examples/jwt_logged_in.resp
M src/plone/restapi/tests/http-examples/navroot_site_get.resp
M src/plone/restapi/tests/http-examples/navroot_standard_site_content_get.resp
M src/plone/restapi/tests/http-examples/navroot_standard_site_content_get_expansion.resp
M src/plone/restapi/tests/http-examples/navroot_standard_site_get.resp
M src/plone/restapi/tests/http-examples/navroot_standard_site_get_expansion.resp
M src/plone/restapi/tests/http-examples/site_get_expand_navroot.resp
M src/plone/restapi/tests/http-examples/siteroot.resp
  • Loading branch information
davisagli committed Sep 12, 2024
1 parent e397f95 commit 0196f1d
Showing 1 changed file with 49 additions and 48 deletions.
Loading

0 comments on commit 0196f1d

Please sign in to comment.