-
-
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/5.2.x Date: 2020-09-28T15:35:11+02:00 Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> Commit: plone/Products.CMFPlone@52a3267 No longer consider calling len(batch) as deprecated. The deprecation warning is unvoidable with current `Products.PageTemplates` code. Fixes plone/Products.CMFPlone#3176 Files changed: A news/3176.bugfix M Products/CMFPlone/PloneBatch.py Repository: Products.CMFPlone Branch: refs/heads/5.2.x Date: 2020-09-28T20:58:40+02:00 Author: Jens W. Klein (jensens) <jk@kleinundpartner.at> Commit: plone/Products.CMFPlone@b03619d Merge pull request #3187 from plone/maurits/un-deprecate-len-batch-issue-3176 No longer consider calling len(batch) as deprecated. Files changed: A news/3176.bugfix M Products/CMFPlone/PloneBatch.py
- Loading branch information
Showing
1 changed file
with
20 additions
and
17 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,34 +1,37 @@ | ||
Repository: Products.CMFFormController | ||
Repository: Products.CMFPlone | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2020-09-28T14:49:08+02:00 | ||
Branch: refs/heads/5.2.x | ||
Date: 2020-09-28T15:35:11+02:00 | ||
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> | ||
Commit: https://github.com/plone/Products.CMFFormController/commit/72b57cf3daf8724d29e9d7a085c44cdd7ad04bc3 | ||
Commit: https://github.com/plone/Products.CMFPlone/commit/52a3267ead37582f49b0f0c9ddcdc2f13d2eae2e | ||
|
||
Tests: set request method to POST in a way that works on Plone 6 as well. | ||
No longer consider calling len(batch) as deprecated. | ||
|
||
The deprecation warning is unvoidable with current `Products.PageTemplates` code. | ||
Fixes https://github.com/plone/Products.CMFPlone/issues/3176 | ||
|
||
Files changed: | ||
A news/3057.bugfix | ||
M Products/CMFFormController/tests/testRedirectTo.py | ||
A news/3176.bugfix | ||
M Products/CMFPlone/PloneBatch.py | ||
|
||
b'diff --git a/Products/CMFFormController/tests/testRedirectTo.py b/Products/CMFFormController/tests/testRedirectTo.py\nindex 4424014..35a9628 100644\n--- a/Products/CMFFormController/tests/testRedirectTo.py\n+++ b/Products/CMFFormController/tests/testRedirectTo.py\n@@ -7,8 +7,8 @@\n from plone.app.testing import TEST_USER_ID\n from plone.app.testing import TEST_USER_NAME\n from plone.app.testing import TEST_USER_PASSWORD\n+from plone.testing.zope import Browser\n from plone.protect import createToken\n-from plone.testing.z2 import Browser\n \n import transaction\n import unittest\n@@ -98,6 +98,7 @@ def test_attacker_redirect(self):\n \n # The same without the testbrowser\n self.assertIsNone(self.request.response.headers.get(\'location\'))\n+ self.request.environ["REQUEST_METHOD"] = "POST"\n self.request.REQUEST_METHOD = \'POST\'\n self.request.form[\'workflow_action\'] = \'publish\'\n self.request.form[\'paths\'] = path\ndiff --git a/news/3057.bugfix b/news/3057.bugfix\nnew file mode 100644\nindex 0000000..3f3971f\n--- /dev/null\n+++ b/news/3057.bugfix\n@@ -0,0 +1,2 @@\n+Tests: set request method to POST in a way that works on Plone 6 as well.\n+[maurits]\n' | ||
b"diff --git a/Products/CMFPlone/PloneBatch.py b/Products/CMFPlone/PloneBatch.py\nindex 2f8737297c..68687dc93a 100644\n--- a/Products/CMFPlone/PloneBatch.py\n+++ b/Products/CMFPlone/PloneBatch.py\n@@ -20,12 +20,17 @@ def __init__(self, sequence, size, start=0, end=0, orphan=0,\n self.b_start_str = b_start_str\n \n def __len__(self):\n+ # Note: Using len() was deprecated for several years.\n+ # It was recommended to explicitly either use the `length` attribute\n+ # for the size of the current page, which is what we return now,\n+ # or use the `sequence_length` attribute for the size of the\n+ # entire sequence.\n+ # But the deprecation was reverted for Plone 5.2.3,\n+ # because core code in Products.PageTemplates called `len`\n+ # on batches, making the deprecation warning unavoidable\n+ # and thus unnecessary.\n+ # See https://github.com/plone/Products.CMFPlone/issues/3176\n return self.length\n- __len__ = deprecated(__len__,\n- ('Using len() is deprecated. Use the `length` attribute for the '\n- 'size of the current page, which is what we return now. '\n- 'Use the `sequence_length` attribute for the size of the '\n- 'entire sequence. '))\n \n def __bool__(self):\n # Without __bool__ a bool(self) would call len(self), which\ndiff --git a/news/3176.bugfix b/news/3176.bugfix\nnew file mode 100644\nindex 0000000000..56e075e5e5\n--- /dev/null\n+++ b/news/3176.bugfix\n@@ -0,0 +1,4 @@\n+No longer consider calling ``len(batch)`` as deprecated.\n+The deprecation warning is unvoidable with current ``Products.PageTemplates`` code.\n+Fixes `issue 3176 <https://github.com/plone/Products.CMFPlone/issues/3176>`_.\n+maurits\n" | ||
|
||
Repository: Products.CMFFormController | ||
Repository: Products.CMFPlone | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2020-09-28T18:06:16+02:00 | ||
Branch: refs/heads/5.2.x | ||
Date: 2020-09-28T20:58:40+02:00 | ||
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at> | ||
Commit: https://github.com/plone/Products.CMFFormController/commit/a3b0b67bd323225177887d244afef3ce7b7aba0d | ||
Commit: https://github.com/plone/Products.CMFPlone/commit/b03619de5577c63e4152e775b91505cb1257f105 | ||
|
||
Merge pull request #26 from plone/maurits/folder_publish | ||
Merge pull request #3187 from plone/maurits/un-deprecate-len-batch-issue-3176 | ||
|
||
Tests: set request method to POST in a way that works on Plone 6 too | ||
No longer consider calling len(batch) as deprecated. | ||
|
||
Files changed: | ||
A news/3057.bugfix | ||
M Products/CMFFormController/tests/testRedirectTo.py | ||
A news/3176.bugfix | ||
M Products/CMFPlone/PloneBatch.py | ||
|
||
b'diff --git a/Products/CMFFormController/tests/testRedirectTo.py b/Products/CMFFormController/tests/testRedirectTo.py\nindex 4424014..35a9628 100644\n--- a/Products/CMFFormController/tests/testRedirectTo.py\n+++ b/Products/CMFFormController/tests/testRedirectTo.py\n@@ -7,8 +7,8 @@\n from plone.app.testing import TEST_USER_ID\n from plone.app.testing import TEST_USER_NAME\n from plone.app.testing import TEST_USER_PASSWORD\n+from plone.testing.zope import Browser\n from plone.protect import createToken\n-from plone.testing.z2 import Browser\n \n import transaction\n import unittest\n@@ -98,6 +98,7 @@ def test_attacker_redirect(self):\n \n # The same without the testbrowser\n self.assertIsNone(self.request.response.headers.get(\'location\'))\n+ self.request.environ["REQUEST_METHOD"] = "POST"\n self.request.REQUEST_METHOD = \'POST\'\n self.request.form[\'workflow_action\'] = \'publish\'\n self.request.form[\'paths\'] = path\ndiff --git a/news/3057.bugfix b/news/3057.bugfix\nnew file mode 100644\nindex 0000000..3f3971f\n--- /dev/null\n+++ b/news/3057.bugfix\n@@ -0,0 +1,2 @@\n+Tests: set request method to POST in a way that works on Plone 6 as well.\n+[maurits]\n' | ||
b"diff --git a/Products/CMFPlone/PloneBatch.py b/Products/CMFPlone/PloneBatch.py\nindex 2f8737297c..68687dc93a 100644\n--- a/Products/CMFPlone/PloneBatch.py\n+++ b/Products/CMFPlone/PloneBatch.py\n@@ -20,12 +20,17 @@ def __init__(self, sequence, size, start=0, end=0, orphan=0,\n self.b_start_str = b_start_str\n \n def __len__(self):\n+ # Note: Using len() was deprecated for several years.\n+ # It was recommended to explicitly either use the `length` attribute\n+ # for the size of the current page, which is what we return now,\n+ # or use the `sequence_length` attribute for the size of the\n+ # entire sequence.\n+ # But the deprecation was reverted for Plone 5.2.3,\n+ # because core code in Products.PageTemplates called `len`\n+ # on batches, making the deprecation warning unavoidable\n+ # and thus unnecessary.\n+ # See https://github.com/plone/Products.CMFPlone/issues/3176\n return self.length\n- __len__ = deprecated(__len__,\n- ('Using len() is deprecated. Use the `length` attribute for the '\n- 'size of the current page, which is what we return now. '\n- 'Use the `sequence_length` attribute for the size of the '\n- 'entire sequence. '))\n \n def __bool__(self):\n # Without __bool__ a bool(self) would call len(self), which\ndiff --git a/news/3176.bugfix b/news/3176.bugfix\nnew file mode 100644\nindex 0000000000..56e075e5e5\n--- /dev/null\n+++ b/news/3176.bugfix\n@@ -0,0 +1,4 @@\n+No longer consider calling ``len(batch)`` as deprecated.\n+The deprecation warning is unvoidable with current ``Products.PageTemplates`` code.\n+Fixes `issue 3176 <https://github.com/plone/Products.CMFPlone/issues/3176>`_.\n+maurits\n" | ||
|