Skip to content

Commit

Permalink
[fc] Repository: plone.volto
Browse files Browse the repository at this point in the history
Branch: refs/heads/main
Date: 2024-06-18T17:38:12+02:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: plone/plone.volto@2f42bc4

Do not fail on startup when the requests library is missing.

Conditionally load the views to migrate to Volto: only when the ``requests`` library is available.
We don't want to make this a hard dependency.
If you need the migration views, you should include the ``requests`` package yourself.
Fixes plone/plone.volto#152

Files changed:
A news/152.bugfix
M src/plone/volto/browser/configure.zcml
Repository: plone.volto

Branch: refs/heads/main
Date: 2024-06-18T15:08:17-07:00
Author: David Glick (davisagli) <david@glicksoftware.com>
Commit: plone/plone.volto@7df9f28

Merge pull request #154 from plone/maurits-conditional-requests

Do not fail on startup when the requests library is missing.

Files changed:
A news/152.bugfix
M src/plone/volto/browser/configure.zcml
  • Loading branch information
davisagli committed Jun 18, 2024
1 parent d3d5615 commit 2f0789e
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions last_commit.txt
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
Repository: plone.testing
Repository: plone.volto


Branch: refs/heads/master
Date: 2024-06-17T13:52:16+02:00
Author: Godefroid Chapelle (gotcha) <gotcha@bubblenet.be>
Commit: https://github.com/plone/plone.testing/commit/0374059340e07e7f04878c2954d9938f2941f7a2

use BytesIO while setting up test Response
Branch: refs/heads/main
Date: 2024-06-18T17:38:12+02:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: https://github.com/plone/plone.volto/commit/2f42bc45f92784adfa79977544cbb2e7f7b3598f

HTTPResponse uses bytes, not string
Do not fail on startup when the requests library is missing.

However, sys.stdout uses string
Conditionally load the views to migrate to Volto: only when the ``requests`` library is available.
We don't want to make this a hard dependency.
If you need the migration views, you should include the ``requests`` package yourself.
Fixes https://github.com/plone/plone.volto/issues/152

Files changed:
A news/fix_makeTestRequest.bugfix
M src/plone/testing/zope.py
A news/152.bugfix
M src/plone/volto/browser/configure.zcml

b'diff --git a/news/fix_makeTestRequest.bugfix b/news/fix_makeTestRequest.bugfix\nnew file mode 100644\nindex 0000000..8432720\n--- /dev/null\n+++ b/news/fix_makeTestRequest.bugfix\n@@ -0,0 +1 @@\n+makeTestRequest: use BytesIO to set up the test Response. @gotcha\ndiff --git a/src/plone/testing/zope.py b/src/plone/testing/zope.py\nindex 52d9df4..2706879 100644\n--- a/src/plone/testing/zope.py\n+++ b/src/plone/testing/zope.py\n@@ -175,8 +175,8 @@ def setRoles(userFolder, userId, roles):\n \n def makeTestRequest(environ=None):\n """Return an HTTPRequest object suitable for testing views."""\n+ from io import BytesIO\n from sys import stdin\n- from sys import stdout\n from zope.publisher.browser import setDefaultSkin\n from ZPublisher.HTTPRequest import HTTPRequest\n from ZPublisher.HTTPResponse import HTTPResponse\n@@ -187,7 +187,7 @@ def makeTestRequest(environ=None):\n environ.setdefault("SERVER_PORT", "80")\n environ.setdefault("REQUEST_METHOD", "GET")\n \n- resp = HTTPResponse(stdout=stdout)\n+ resp = HTTPResponse(stdout=BytesIO())\n req = HTTPRequest(stdin, environ, resp)\n req._steps = ["noobject"] # Fake a published object.\n req["ACTUAL_URL"] = req.get("URL")\n'
b'diff --git a/news/152.bugfix b/news/152.bugfix\nnew file mode 100644\nindex 0000000..34dc4e5\n--- /dev/null\n+++ b/news/152.bugfix\n@@ -0,0 +1,5 @@\n+Do not fail on startup when the ``requests`` library is missing.\n+Conditionally load the views to migrate to Volto: only when the ``requests`` library is available.\n+We don\'t want to make this a hard dependency.\n+If you need the migration views, you should include the ``requests`` package yourself.\n+[maurits]\ndiff --git a/src/plone/volto/browser/configure.zcml b/src/plone/volto/browser/configure.zcml\nindex 78ce7e6..ccebe58 100644\n--- a/src/plone/volto/browser/configure.zcml\n+++ b/src/plone/volto/browser/configure.zcml\n@@ -32,23 +32,25 @@\n zcml:condition="have plone-5"\n />\n \n- <browser:page\n- name="migrate_richtext"\n- for="zope.interface.Interface"\n- class=".migrate_richtext.MigrateRichTextToVoltoBlocks"\n- template="migrate_richtext.pt"\n- permission="cmf.ManagePortal"\n- zcml:condition="have plone-60"\n- />\n+ <configure zcml:condition="installed requests">\n+ <browser:page\n+ name="migrate_richtext"\n+ for="zope.interface.Interface"\n+ class=".migrate_richtext.MigrateRichTextToVoltoBlocks"\n+ template="migrate_richtext.pt"\n+ permission="cmf.ManagePortal"\n+ zcml:condition="have plone-60"\n+ />\n \n- <browser:page\n- name="migrate_to_volto"\n- for="zope.interface.Interface"\n- class=".migrate_to_volto.MigrateToVolto"\n- template="migrate_to_volto.pt"\n- permission="cmf.ManagePortal"\n- zcml:condition="have plone-60"\n- />\n+ <browser:page\n+ name="migrate_to_volto"\n+ for="zope.interface.Interface"\n+ class=".migrate_to_volto.MigrateToVolto"\n+ template="migrate_to_volto.pt"\n+ permission="cmf.ManagePortal"\n+ zcml:condition="have plone-60"\n+ />\n+ </configure>\n \n <browser:viewlet\n name="voltobackendwarning"\n'

Repository: plone.testing
Repository: plone.volto


Branch: refs/heads/master
Date: 2024-06-18T00:42:19+02:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: https://github.com/plone/plone.testing/commit/23d09d2db7d53f50ec64b176f262a6a395c92b83
Branch: refs/heads/main
Date: 2024-06-18T15:08:17-07:00
Author: David Glick (davisagli) <david@glicksoftware.com>
Commit: https://github.com/plone/plone.volto/commit/7df9f28766beac1a70d1c00f6b2057ed31d05b4f

Merge pull request #94 from plone/fix_makeTestRequest
Merge pull request #154 from plone/maurits-conditional-requests

use BytesIO while setting up test Response
Do not fail on startup when the requests library is missing.

Files changed:
A news/fix_makeTestRequest.bugfix
M src/plone/testing/zope.py
A news/152.bugfix
M src/plone/volto/browser/configure.zcml

b'diff --git a/news/fix_makeTestRequest.bugfix b/news/fix_makeTestRequest.bugfix\nnew file mode 100644\nindex 0000000..8432720\n--- /dev/null\n+++ b/news/fix_makeTestRequest.bugfix\n@@ -0,0 +1 @@\n+makeTestRequest: use BytesIO to set up the test Response. @gotcha\ndiff --git a/src/plone/testing/zope.py b/src/plone/testing/zope.py\nindex 52d9df4..2706879 100644\n--- a/src/plone/testing/zope.py\n+++ b/src/plone/testing/zope.py\n@@ -175,8 +175,8 @@ def setRoles(userFolder, userId, roles):\n \n def makeTestRequest(environ=None):\n """Return an HTTPRequest object suitable for testing views."""\n+ from io import BytesIO\n from sys import stdin\n- from sys import stdout\n from zope.publisher.browser import setDefaultSkin\n from ZPublisher.HTTPRequest import HTTPRequest\n from ZPublisher.HTTPResponse import HTTPResponse\n@@ -187,7 +187,7 @@ def makeTestRequest(environ=None):\n environ.setdefault("SERVER_PORT", "80")\n environ.setdefault("REQUEST_METHOD", "GET")\n \n- resp = HTTPResponse(stdout=stdout)\n+ resp = HTTPResponse(stdout=BytesIO())\n req = HTTPRequest(stdin, environ, resp)\n req._steps = ["noobject"] # Fake a published object.\n req["ACTUAL_URL"] = req.get("URL")\n'
b'diff --git a/news/152.bugfix b/news/152.bugfix\nnew file mode 100644\nindex 0000000..34dc4e5\n--- /dev/null\n+++ b/news/152.bugfix\n@@ -0,0 +1,5 @@\n+Do not fail on startup when the ``requests`` library is missing.\n+Conditionally load the views to migrate to Volto: only when the ``requests`` library is available.\n+We don\'t want to make this a hard dependency.\n+If you need the migration views, you should include the ``requests`` package yourself.\n+[maurits]\ndiff --git a/src/plone/volto/browser/configure.zcml b/src/plone/volto/browser/configure.zcml\nindex 78ce7e6..ccebe58 100644\n--- a/src/plone/volto/browser/configure.zcml\n+++ b/src/plone/volto/browser/configure.zcml\n@@ -32,23 +32,25 @@\n zcml:condition="have plone-5"\n />\n \n- <browser:page\n- name="migrate_richtext"\n- for="zope.interface.Interface"\n- class=".migrate_richtext.MigrateRichTextToVoltoBlocks"\n- template="migrate_richtext.pt"\n- permission="cmf.ManagePortal"\n- zcml:condition="have plone-60"\n- />\n+ <configure zcml:condition="installed requests">\n+ <browser:page\n+ name="migrate_richtext"\n+ for="zope.interface.Interface"\n+ class=".migrate_richtext.MigrateRichTextToVoltoBlocks"\n+ template="migrate_richtext.pt"\n+ permission="cmf.ManagePortal"\n+ zcml:condition="have plone-60"\n+ />\n \n- <browser:page\n- name="migrate_to_volto"\n- for="zope.interface.Interface"\n- class=".migrate_to_volto.MigrateToVolto"\n- template="migrate_to_volto.pt"\n- permission="cmf.ManagePortal"\n- zcml:condition="have plone-60"\n- />\n+ <browser:page\n+ name="migrate_to_volto"\n+ for="zope.interface.Interface"\n+ class=".migrate_to_volto.MigrateToVolto"\n+ template="migrate_to_volto.pt"\n+ permission="cmf.ManagePortal"\n+ zcml:condition="have plone-60"\n+ />\n+ </configure>\n \n <browser:viewlet\n name="voltobackendwarning"\n'

0 comments on commit 2f0789e

Please sign in to comment.