From c1f7006ce149dc498e97aa92f5f4edf75fe51a95 Mon Sep 17 00:00:00 2001 From: Matteo Gamboz Date: Fri, 21 Feb 2025 13:43:31 +0100 Subject: [PATCH 1/5] zconsole needs zope.conf (not zope.ini) --- docs/admin-guide/run-plone.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/admin-guide/run-plone.md b/docs/admin-guide/run-plone.md index 66eb6ed30..d4c561be0 100644 --- a/docs/admin-guide/run-plone.md +++ b/docs/admin-guide/run-plone.md @@ -92,7 +92,7 @@ Buildout: pip: : ```shell - bin/zconsole debug instance/etc/zope.ini + bin/zconsole debug instance/etc/zope.conf ``` `cookiecutter-plone-starter`: From 9f3032003f14cd4d909765bae0858ec30bb1728a Mon Sep 17 00:00:00 2001 From: Matteo Gamboz Date: Fri, 21 Feb 2025 13:46:40 +0100 Subject: [PATCH 2/5] add a note to setRequest taken from https://community.plone.org/t/interactive-shell-for-debugging-with-plone-6-docker-compose-the-wsgi-equivalent-of-bin-instance-debug/16370/9 --- docs/admin-guide/run-plone.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/admin-guide/run-plone.md b/docs/admin-guide/run-plone.md index d4c561be0..e34f46869 100644 --- a/docs/admin-guide/run-plone.md +++ b/docs/admin-guide/run-plone.md @@ -101,3 +101,11 @@ pip: ``` For any of these commands, press {kbd}`ctrl-d` to stop the process. + +### Set a "fake" request + +To make sure that the request is fully set up for any code that uses `zope.globalrequest.getRequest` you might need to do: +: ```python + from zope.globalrequest import setRequest + setRequest(app.REQUEST) + ``` From 08d2ee761322b83fdec60acb4819d5e405c08dea Mon Sep 17 00:00:00 2001 From: Matteo Gamboz Date: Fri, 21 Feb 2025 14:57:04 +0100 Subject: [PATCH 3/5] Apply suggestions from code review Co-authored-by: Steve Piercy --- docs/admin-guide/run-plone.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/admin-guide/run-plone.md b/docs/admin-guide/run-plone.md index e34f46869..f70e61cf1 100644 --- a/docs/admin-guide/run-plone.md +++ b/docs/admin-guide/run-plone.md @@ -104,8 +104,9 @@ For any of these commands, press {kbd}`ctrl-d` to stop the process. ### Set a "fake" request -To make sure that the request is fully set up for any code that uses `zope.globalrequest.getRequest` you might need to do: -: ```python +To make sure that the request is fully set up for any code that uses `zope.globalrequest.getRequest`, you might need to use the following code. + +```python from zope.globalrequest import setRequest setRequest(app.REQUEST) ``` From 5d5bc256dddf8f30fad7f8661dc91111fd154744 Mon Sep 17 00:00:00 2001 From: Matteo Gamboz Date: Fri, 21 Feb 2025 14:59:01 +0100 Subject: [PATCH 4/5] tidy up code example fix https://github.com/plone/documentation/pull/1872/files#r1965496404 --- docs/admin-guide/run-plone.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/admin-guide/run-plone.md b/docs/admin-guide/run-plone.md index f70e61cf1..d070beda3 100644 --- a/docs/admin-guide/run-plone.md +++ b/docs/admin-guide/run-plone.md @@ -107,6 +107,6 @@ For any of these commands, press {kbd}`ctrl-d` to stop the process. To make sure that the request is fully set up for any code that uses `zope.globalrequest.getRequest`, you might need to use the following code. ```python - from zope.globalrequest import setRequest - setRequest(app.REQUEST) - ``` +from zope.globalrequest import setRequest +setRequest(app.REQUEST) +``` From 4e4266ae912f806f09cf3586f76926b4bb9e2869 Mon Sep 17 00:00:00 2001 From: Matteo Gamboz Date: Mon, 24 Feb 2025 16:12:41 +0100 Subject: [PATCH 5/5] Add an HTTPRequest at app.REQUEST before calling setRequest(app.REQUEST) --- docs/admin-guide/run-plone.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/admin-guide/run-plone.md b/docs/admin-guide/run-plone.md index d070beda3..f1d8ab8f0 100644 --- a/docs/admin-guide/run-plone.md +++ b/docs/admin-guide/run-plone.md @@ -107,6 +107,9 @@ For any of these commands, press {kbd}`ctrl-d` to stop the process. To make sure that the request is fully set up for any code that uses `zope.globalrequest.getRequest`, you might need to use the following code. ```python +from Testing.makerequest import makerequest from zope.globalrequest import setRequest + +app = makerequest(app) setRequest(app.REQUEST) ```