-
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Branch: refs/heads/main Date: 2024-09-11T20:06:13-07:00 Author: Maurits van Rees (mauritsvanrees) <[email protected]> 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: ((<FolderishDocument at /PloneVolto/page>, <WSGIRequest, URL=http://localhost:8080/PloneVolto/++api++/page/GET_application_json_>), <InterfaceClass zope.interface.Interface>, '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
Showing
1 changed file
with
49 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,52 @@ | ||
Repository: plone.app.event | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2024-09-06T12:41:14+02:00 | ||
Author: Yuri (yurj) <[email protected]> | ||
Commit: https://github.com/plone/plone.app.event/commit/c87af95b3b19da9625e2d526ae2b5f8e65de9f31 | ||
|
||
Update event_summary.pt | ||
|
||
If the name is None, display the mail. Otherwise, a person icon with no useful info is displayed. | ||
|
||
Files changed: | ||
M plone/app/event/browser/event_summary.pt | ||
|
||
b'diff --git a/plone/app/event/browser/event_summary.pt b/plone/app/event/browser/event_summary.pt\nindex ffc11d49..b715c119 100644\n--- a/plone/app/event/browser/event_summary.pt\n+++ b/plone/app/event/browser/event_summary.pt\n@@ -140,7 +140,7 @@\n <p class="card-text"\n tal:condition="mail"\n ><a class="email"\n- tal:content="name"\n+ tal:content="python: name if name is not None else mail"\n tal:attributes="\n href string:mailto:${mail};\n "\n' | ||
|
||
Repository: plone.app.event | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2024-09-06T12:44:58+02:00 | ||
Author: Yuri (yurj) <[email protected]> | ||
Commit: https://github.com/plone/plone.app.event/commit/af7374ea0c19d6f7cc4e5d932fc7d2cc688001fb | ||
|
||
Create 407.bugfix | ||
|
||
Files changed: | ||
A news/407.bugfix | ||
|
||
b'diff --git a/news/407.bugfix b/news/407.bugfix\nnew file mode 100644\nindex 000000000..1b59deb73\n--- /dev/null\n+++ b/news/407.bugfix\n@@ -0,0 +1,2 @@\n+[yurj]\n+If the name is None, display the mail. Otherwise, a person icon with no useful info is displayed.\n' | ||
|
||
Repository: plone.app.event | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2024-09-09T09:18:19+02:00 | ||
Author: Yuri (yurj) <[email protected]> | ||
Commit: https://github.com/plone/plone.app.event/commit/bc1bb1228098894fb5697365dd5e6c7fa6d732b3 | ||
|
||
Merge pull request #407 from plone/yurj-link-to-mail-if-name-none | ||
|
||
Yurj link to mail if name none | ||
Repository: plone.restapi | ||
|
||
|
||
Branch: refs/heads/main | ||
Date: 2024-09-11T20:06:13-07:00 | ||
Author: Maurits van Rees (mauritsvanrees) <[email protected]> | ||
Commit: https://github.com/plone/plone.restapi/commit/057c59a04d4cb2e5d51e83cdab41b7e921aaae88 | ||
|
||
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: | ||
((<FolderishDocument at /PloneVolto/page>, | ||
<WSGIRequest, URL=http://localhost:8080/PloneVolto/++api++/page/GET_application_json_>), | ||
<InterfaceClass zope.interface.Interface>, 'conversation_view') | ||
``` | ||
|
||
* Fix tests: Plone Site now gets allow_discussion false instead of null. | ||
|
||
Files changed: | ||
A news/407.bugfix | ||
M plone/app/event/browser/event_summary.pt | ||
|
||
b'diff --git a/news/407.bugfix b/news/407.bugfix\nnew file mode 100644\nindex 000000000..1b59deb73\n--- /dev/null\n+++ b/news/407.bugfix\n@@ -0,0 +1,2 @@\n+[yurj]\n+If the name is None, display the mail. Otherwise, a person icon with no useful info is displayed.\ndiff --git a/plone/app/event/browser/event_summary.pt b/plone/app/event/browser/event_summary.pt\nindex ffc11d499..b715c1197 100644\n--- a/plone/app/event/browser/event_summary.pt\n+++ b/plone/app/event/browser/event_summary.pt\n@@ -140,7 +140,7 @@\n <p class="card-text"\n tal:condition="mail"\n ><a class="email"\n- tal:content="name"\n+ tal:content="python: name if name is not None else mail"\n tal:attributes="\n href string:mailto:${mail};\n "\n' | ||
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 | ||
|
||
b'diff --git a/news/1808.bugfix b/news/1808.bugfix\nnew file mode 100644\nindex 0000000000..7a8ab1df8e\n--- /dev/null\n+++ b/news/1808.bugfix\n@@ -0,0 +1,2 @@\n+Fix error getting allow_discussion value when p.a.discussion is not activated.\n+[maurits]\ndiff --git a/src/plone/restapi/serializer/dxcontent.py b/src/plone/restapi/serializer/dxcontent.py\nindex 0154f1c91f..1c546d091d 100644\n--- a/src/plone/restapi/serializer/dxcontent.py\n+++ b/src/plone/restapi/serializer/dxcontent.py\n@@ -23,6 +23,7 @@\n from Products.CMFPlone.utils import base_hasattr\n from Products.CMFCore.interfaces import IContentish\n from zope.component import adapter\n+from zope.component import ComponentLookupError\n from zope.component import getMultiAdapter\n from zope.component import queryMultiAdapter\n from zope.component import queryUtility\n@@ -41,15 +42,16 @@\n \n \n def get_allow_discussion_value(context, request, result):\n- # This test is to handle the plone.app.discussion not being installed situation\n- if "allow_discussion" in result:\n- # Check if the content item implements the IContentish interface\n- if IContentish.providedBy(context):\n- result["allow_discussion"] = getMultiAdapter(\n- (context, request), name="conversation_view"\n- ).enabled()\n- else:\n- result["allow_discussion"] = False\n+ # This test is to handle the situation of plone.app.discussion not being installed\n+ # or not being activated.\n+ if "allow_discussion" in result and IContentish.providedBy(context):\n+ try:\n+ view = getMultiAdapter((context, request), name="conversation_view")\n+ result["allow_discussion"] = view.enabled()\n+ return\n+ except ComponentLookupError:\n+ pass\n+ result["allow_discussion"] = False\n \n \n @implementer(ISerializeToJson)\ndiff --git a/src/plone/restapi/tests/http-examples/jwt_logged_in.resp b/src/plone/restapi/tests/http-examples/jwt_logged_in.resp\nindex 51b29477ff..df8437977a 100644\n--- a/src/plone/restapi/tests/http-examples/jwt_logged_in.resp\n+++ b/src/plone/restapi/tests/http-examples/jwt_logged_in.resp\n@@ -31,7 +31,7 @@ Content-Type: application/json\n "@id": "http://localhost:55001/plone",\n "@type": "Plone Site",\n "UID": "55c25ebc220d400393574f37d648727c",\n- "allow_discussion": null,\n+ "allow_discussion": false,\n "contributors": [],\n "creators": [\n "admin"\ndiff --git a/src/plone/restapi/tests/http-examples/navroot_site_get.resp b/src/plone/restapi/tests/http-examples/navroot_site_get.resp\nindex 8773250024..1f5d023ab3 100644\n--- a/src/plone/restapi/tests/http-examples/navroot_site_get.resp\n+++ b/src/plone/restapi/tests/http-examples/navroot_site_get.resp\n@@ -33,7 +33,7 @@ Content-Type: application/json\n "@id": "http://localhost:55001/plone",\n "@type": "Plone Site",\n "UID": "55c25ebc220d400393574f37d648727c",\n- "allow_discussion": null,\n+ "allow_discussion": false,\n "contributors": [],\n "creators": [\n "admin"\ndiff --git a/src/plone/restapi/tests/http-examples/navroot_standard_site_content_get.resp b/src/plone/restapi/tests/http-examples/navroot_standard_site_content_get.resp\nindex 0c374d5389..300b311865 100644\n--- a/src/plone/restapi/tests/http-examples/navroot_standard_site_content_get.resp\n+++ b/src/plone/restapi/tests/http-examples/navroot_standard_site_content_get.resp\n@@ -33,7 +33,7 @@ Content-Type: application/json\n "@id": "http://localhost:55001/plone",\n "@type": "Plone Site",\n "UID": "55c25ebc220d400393574f37d648727c",\n- "allow_discussion": null,\n+ "allow_discussion": false,\n "contributors": [],\n "creators": [\n "admin"\ndiff --git a/src/plone/restapi/tests/http-examples/navroot_standard_site_content_get_expansion.resp b/src/plone/restapi/tests/http-examples/navroot_standard_site_content_get_expansion.resp\nindex a421c0b009..ccaeb686dd 100644\n--- a/src/plone/restapi/tests/http-examples/navroot_standard_site_content_get_expansion.resp\n+++ b/src/plone/restapi/tests/http-examples/navroot_standard_site_content_get_expansion.resp\n@@ -50,7 +50,7 @@ Content-Type: application/json\n "@id": "http://localhost:55001/plone",\n "@type": "Plone Site",\n "UID": "55c25ebc220d400393574f37d648727c",\n- "allow_discussion": null,\n+ "allow_discussion": false,\n "contributors": [],\n "creators": [\n "admin"\ndiff --git a/src/plone/restapi/tests/http-examples/navroot_standard_site_get.resp b/src/plone/restapi/tests/http-examples/navroot_standard_site_get.resp\nindex 532ec7d6ca..abc42909a4 100644\n--- a/src/plone/restapi/tests/http-examples/navroot_standard_site_get.resp\n+++ b/src/plone/restapi/tests/http-examples/navroot_standard_site_get.resp\n@@ -33,7 +33,7 @@ Content-Type: application/json\n "@id": "http://localhost:55001/plone",\n "@type": "Plone Site",\n "UID": "55c25ebc220d400393574f37d648727c",\n- "allow_discussion": null,\n+ "allow_discussion": false,\n "contributors": [],\n "creators": [\n "admin"\ndiff --git a/src/plone/restapi/tests/http-examples/navroot_standard_site_get_expansion.resp b/src/plone/restapi/tests/http-examples/navroot_standard_site_get_expansion.resp\nindex 0a33c7475c..b3391b8314 100644\n--- a/src/plone/restapi/tests/http-examples/navroot_standard_site_get_expansion.resp\n+++ b/src/plone/restapi/tests/http-examples/navroot_standard_site_get_expansion.resp\n@@ -50,7 +50,7 @@ Content-Type: application/json\n "@id": "http://localhost:55001/plone",\n "@type": "Plone Site",\n "UID": "55c25ebc220d400393574f37d648727c",\n- "allow_discussion": null,\n+ "allow_discussion": false,\n "contributors": [],\n "creators": [\n "admin"\n@@ -101,7 +101,7 @@ Content-Type: application/json\n "@id": "http://localhost:55001/plone",\n "@type": "Plone Site",\n "UID": "55c25ebc220d400393574f37d648727c",\n- "allow_discussion": null,\n+ "allow_discussion": false,\n "contributors": [],\n "creators": [\n "admin"\ndiff --git a/src/plone/restapi/tests/http-examples/site_get_expand_navroot.resp b/src/plone/restapi/tests/http-examples/site_get_expand_navroot.resp\nindex 00a8775fa7..d92a212bdc 100644\n--- a/src/plone/restapi/tests/http-examples/site_get_expand_navroot.resp\n+++ b/src/plone/restapi/tests/http-examples/site_get_expand_navroot.resp\n@@ -50,7 +50,7 @@ Content-Type: application/json\n "@id": "http://localhost:55001/plone",\n "@type": "Plone Site",\n "UID": "55c25ebc220d400393574f37d648727c",\n- "allow_discussion": null,\n+ "allow_discussion": false,\n "contributors": [],\n "creators": [\n "admin"\n@@ -125,7 +125,7 @@ Content-Type: application/json\n "@id": "http://localhost:55001/plone",\n "@type": "Plone Site",\n "UID": "55c25ebc220d400393574f37d648727c",\n- "allow_discussion": null,\n+ "allow_discussion": false,\n "contributors": [],\n "creators": [\n "admin"\ndiff --git a/src/plone/restapi/tests/http-examples/siteroot.resp b/src/plone/restapi/tests/http-examples/siteroot.resp\nindex 51b29477ff..df8437977a 100644\n--- a/src/plone/restapi/tests/http-examples/siteroot.resp\n+++ b/src/plone/restapi/tests/http-examples/siteroot.resp\n@@ -31,7 +31,7 @@ Content-Type: application/json\n "@id": "http://localhost:55001/plone",\n "@type": "Plone Site",\n "UID": "55c25ebc220d400393574f37d648727c",\n- "allow_discussion": null,\n+ "allow_discussion": false,\n "contributors": [],\n "creators": [\n "admin"\n' | ||
|