-
-
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.
[fc] Repository: plone.app.multilingual
Branch: refs/heads/master Date: 2024-10-07T21:23:19Z Author: pre-commit-ci[bot] (pre-commit-ci[bot]) <66853113+pre-commit-ci[bot]@users.noreply.github.com> Commit: plone/plone.app.multilingual@f607d33 [pre-commit.ci] pre-commit autoupdate updates: - [github.com/asottile/pyupgrade: v3.15.2 → v3.17.0](asottile/pyupgrade@v3.15.2...v3.17.0) - [github.com/psf/black: 24.4.2 → 24.10.0](psf/black@24.4.2...24.10.0) - [github.com/PyCQA/flake8: 7.0.0 → 7.1.1](PyCQA/flake8@7.0.0...7.1.1) - [github.com/collective/i18ndude: 6.2.0 → 6.2.1](collective/i18ndude@6.2.0...6.2.1) Files changed: M .pre-commit-config.yaml Repository: plone.app.multilingual Branch: refs/heads/master Date: 2024-10-13T00:05:44+02:00 Author: Gil Forcada Codinachs (gforcada) <[email protected]> Commit: plone/plone.app.multilingual@58ba7ad Merge pull request #458 from plone/pre-commit-ci-update-config [pre-commit.ci] pre-commit autoupdate Files changed: M .pre-commit-config.yaml
- Loading branch information
Showing
1 changed file
with
20 additions
and
22 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,40 +1,38 @@ | ||
Repository: Products.CMFPlone | ||
Repository: plone.app.multilingual | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2024-10-09T11:28:48+02:00 | ||
Author: Johannes Raggam (thet) <thetetet@gmail.com> | ||
Commit: https://github.com/plone/Products.CMFPlone/commit/67003908f61c7a10891bb3e16361d4c796597d7e | ||
Date: 2024-10-07T21:23:19Z | ||
Author: pre-commit-ci[bot] (pre-commit-ci[bot]) <66853113+pre-commit-ci[bot]@users.noreply.github.com> | ||
Commit: https://github.com/plone/plone.app.multilingual/commit/f607d3334016be2543620edc1f34812a3dc5cd1b | ||
|
||
Restore the capability of the resource registry to serve OFS files as | ||
resources. | ||
[pre-commit.ci] pre-commit autoupdate | ||
|
||
This was possible in Plone 5.2 and broken by the upgrade to Plone 6. | ||
Do not break if the resource is not found or callable. | ||
updates: | ||
- [github.com/asottile/pyupgrade: v3.15.2 → v3.17.0](https://github.com/asottile/pyupgrade/compare/v3.15.2...v3.17.0) | ||
- [github.com/psf/black: 24.4.2 → 24.10.0](https://github.com/psf/black/compare/24.4.2...24.10.0) | ||
- [github.com/PyCQA/flake8: 7.0.0 → 7.1.1](https://github.com/PyCQA/flake8/compare/7.0.0...7.1.1) | ||
- [github.com/collective/i18ndude: 6.2.0 → 6.2.1](https://github.com/collective/i18ndude/compare/6.2.0...6.2.1) | ||
|
||
Files changed: | ||
A news/4022.bugfix | ||
M Products/CMFPlone/resources/utils.py | ||
M Products/CMFPlone/tests/testResourceRegistries.py | ||
M .pre-commit-config.yaml | ||
|
||
b'diff --git a/Products/CMFPlone/resources/utils.py b/Products/CMFPlone/resources/utils.py\nindex a0632ec8dc..4cbb8bbf67 100644\n--- a/Products/CMFPlone/resources/utils.py\n+++ b/Products/CMFPlone/resources/utils.py\n@@ -1,6 +1,7 @@\n from Acquisition import aq_base\n from Acquisition import aq_inner\n from Acquisition import aq_parent\n+from OFS.Image import File\n from plone.base.interfaces.resources import OVERRIDE_RESOURCE_DIRECTORY_NAME\n from plone.resource.file import FilesystemFile\n from plone.resource.interfaces import IResourceDirectory\n@@ -75,9 +76,15 @@ def get_resource(context, path):\n if hasattr(aq_base(resource), "GET"):\n # for FileResource\n result = resource.GET()\n- else:\n+ elif isinstance(resource, File):\n+ # An OFS.Image.File object\n+ result = resource.data\n+ elif callable(resource):\n # any BrowserView\n result = resource()\n+ else:\n+ logger.info("Cannot get data from resource %r", resource)\n+ result = b""\n context.REQUEST.response = response_before\n return result\n \ndiff --git a/Products/CMFPlone/tests/testResourceRegistries.py b/Products/CMFPlone/tests/testResourceRegistries.py\nindex 12021ceb0a..235ba8cf87 100644\n--- a/Products/CMFPlone/tests/testResourceRegistries.py\n+++ b/Products/CMFPlone/tests/testResourceRegistries.py\n@@ -1,3 +1,4 @@\n+from OFS.Image import File\n from plone.app.testing import logout\n from plone.app.testing import setRoles\n from plone.app.testing import SITE_OWNER_NAME\n@@ -13,6 +14,7 @@\n from Products.CMFPlone.resources.browser.resource import REQUEST_CACHE_KEY\n from Products.CMFPlone.resources.browser.resource import ScriptsView\n from Products.CMFPlone.resources.browser.resource import StylesView\n+from Products.CMFPlone.resources.webresource import PloneScriptResource\n from Products.CMFPlone.tests import PloneTestCase\n from zope.component import getUtility\n \n@@ -180,6 +182,30 @@ def test_bundle_depends_on_missing(self):\n # bundle should be skipped when rendering\n self.assertNotIn("http://foo.bar/foobar.js", results)\n \n+ def test_resource_browser_static_resource(self):\n+ resource = PloneScriptResource(self.portal, resource="++resource++plone-admin-ui.js")\n+ self.assertIn(\n+ b"window.onload", resource.file_data,\n+ )\n+\n+ def test_resource_ofs_file(self):\n+ self.portal["foo.js"] = File("foo.js", "Title", b\'console.log()\')\n+ resource = PloneScriptResource(self.portal, resource="foo.js")\n+ self.assertEqual(\n+ resource.file_data, b\'console.log()\',\n+ )\n+\n+ def test_resource_view(self):\n+ resource = PloneScriptResource(self.portal, resource="@@ok")\n+ self.assertEqual(\n+ resource.file_data, b\'OK\',\n+ )\n+\n+ def test_resource_bogus(self):\n+ resource = PloneScriptResource(self.portal, resource="I_do_not_exist")\n+ self.assertEqual(\n+ resource.file_data, b\'I_do_not_exist\',\n+ )\n \n class TestStylesViewlet(PloneTestCase.PloneTestCase):\n def test_styles_viewlet(self):\ndiff --git a/news/4022.bugfix b/news/4022.bugfix\nnew file mode 100644\nindex 0000000000..292aac9553\n--- /dev/null\n+++ b/news/4022.bugfix\n@@ -0,0 +1,2 @@\n+Resource registry: Support OFS.Image.File objects.\n+[ale-rt, thet]\n' | ||
b'diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml\nindex da56023f..f70417dc 100644\n--- a/.pre-commit-config.yaml\n+++ b/.pre-commit-config.yaml\n@@ -7,7 +7,7 @@ ci:\n \n repos:\n - repo: https://github.com/asottile/pyupgrade\n- rev: v3.15.2\n+ rev: v3.17.0\n hooks:\n - id: pyupgrade\n args: [--py38-plus]\n@@ -16,7 +16,7 @@ repos:\n hooks:\n - id: isort\n - repo: https://github.com/psf/black\n- rev: 24.4.2\n+ rev: 24.10.0\n hooks:\n - id: black\n - repo: https://github.com/collective/zpretty\n@@ -32,7 +32,7 @@ repos:\n # """\n ##\n - repo: https://github.com/PyCQA/flake8\n- rev: 7.0.0\n+ rev: 7.1.1\n hooks:\n - id: flake8\n \n@@ -71,7 +71,7 @@ repos:\n - id: check-python-versions\n args: [\'--only\', \'setup.py,pyproject.toml\']\n - repo: https://github.com/collective/i18ndude\n- rev: "6.2.0"\n+ rev: "6.2.1"\n hooks:\n - id: i18ndude\n \n' | ||
|
||
Repository: Products.CMFPlone | ||
Repository: plone.app.multilingual | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2024-10-10T00:14:49+02:00 | ||
Author: Johannes Raggam (thet) <thetetet@gmail.com> | ||
Commit: https://github.com/plone/Products.CMFPlone/commit/ad248d7e0c5ea2b7a0649575abb6c79e891e620c | ||
Date: 2024-10-13T00:05:44+02:00 | ||
Author: Gil Forcada Codinachs (gforcada) <gil.gnome@gmail.com> | ||
Commit: https://github.com/plone/plone.app.multilingual/commit/58ba7ad6bb15b96b683c9d3031037f9218c12d9e | ||
|
||
Merge pull request #4024 from plone/fix-get-resource | ||
Merge pull request #458 from plone/pre-commit-ci-update-config | ||
|
||
[6.1] Restore the capability of the resource registry to serve OFS files as resources | ||
[pre-commit.ci] pre-commit autoupdate | ||
|
||
Files changed: | ||
A news/4022.bugfix | ||
M Products/CMFPlone/resources/utils.py | ||
M Products/CMFPlone/tests/testResourceRegistries.py | ||
M .pre-commit-config.yaml | ||
|
||
b'diff --git a/Products/CMFPlone/resources/utils.py b/Products/CMFPlone/resources/utils.py\nindex a0632ec8dc..4cbb8bbf67 100644\n--- a/Products/CMFPlone/resources/utils.py\n+++ b/Products/CMFPlone/resources/utils.py\n@@ -1,6 +1,7 @@\n from Acquisition import aq_base\n from Acquisition import aq_inner\n from Acquisition import aq_parent\n+from OFS.Image import File\n from plone.base.interfaces.resources import OVERRIDE_RESOURCE_DIRECTORY_NAME\n from plone.resource.file import FilesystemFile\n from plone.resource.interfaces import IResourceDirectory\n@@ -75,9 +76,15 @@ def get_resource(context, path):\n if hasattr(aq_base(resource), "GET"):\n # for FileResource\n result = resource.GET()\n- else:\n+ elif isinstance(resource, File):\n+ # An OFS.Image.File object\n+ result = resource.data\n+ elif callable(resource):\n # any BrowserView\n result = resource()\n+ else:\n+ logger.info("Cannot get data from resource %r", resource)\n+ result = b""\n context.REQUEST.response = response_before\n return result\n \ndiff --git a/Products/CMFPlone/tests/testResourceRegistries.py b/Products/CMFPlone/tests/testResourceRegistries.py\nindex 12021ceb0a..235ba8cf87 100644\n--- a/Products/CMFPlone/tests/testResourceRegistries.py\n+++ b/Products/CMFPlone/tests/testResourceRegistries.py\n@@ -1,3 +1,4 @@\n+from OFS.Image import File\n from plone.app.testing import logout\n from plone.app.testing import setRoles\n from plone.app.testing import SITE_OWNER_NAME\n@@ -13,6 +14,7 @@\n from Products.CMFPlone.resources.browser.resource import REQUEST_CACHE_KEY\n from Products.CMFPlone.resources.browser.resource import ScriptsView\n from Products.CMFPlone.resources.browser.resource import StylesView\n+from Products.CMFPlone.resources.webresource import PloneScriptResource\n from Products.CMFPlone.tests import PloneTestCase\n from zope.component import getUtility\n \n@@ -180,6 +182,30 @@ def test_bundle_depends_on_missing(self):\n # bundle should be skipped when rendering\n self.assertNotIn("http://foo.bar/foobar.js", results)\n \n+ def test_resource_browser_static_resource(self):\n+ resource = PloneScriptResource(self.portal, resource="++resource++plone-admin-ui.js")\n+ self.assertIn(\n+ b"window.onload", resource.file_data,\n+ )\n+\n+ def test_resource_ofs_file(self):\n+ self.portal["foo.js"] = File("foo.js", "Title", b\'console.log()\')\n+ resource = PloneScriptResource(self.portal, resource="foo.js")\n+ self.assertEqual(\n+ resource.file_data, b\'console.log()\',\n+ )\n+\n+ def test_resource_view(self):\n+ resource = PloneScriptResource(self.portal, resource="@@ok")\n+ self.assertEqual(\n+ resource.file_data, b\'OK\',\n+ )\n+\n+ def test_resource_bogus(self):\n+ resource = PloneScriptResource(self.portal, resource="I_do_not_exist")\n+ self.assertEqual(\n+ resource.file_data, b\'I_do_not_exist\',\n+ )\n \n class TestStylesViewlet(PloneTestCase.PloneTestCase):\n def test_styles_viewlet(self):\ndiff --git a/news/4022.bugfix b/news/4022.bugfix\nnew file mode 100644\nindex 0000000000..292aac9553\n--- /dev/null\n+++ b/news/4022.bugfix\n@@ -0,0 +1,2 @@\n+Resource registry: Support OFS.Image.File objects.\n+[ale-rt, thet]\n' | ||
b'diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml\nindex da56023f..f70417dc 100644\n--- a/.pre-commit-config.yaml\n+++ b/.pre-commit-config.yaml\n@@ -7,7 +7,7 @@ ci:\n \n repos:\n - repo: https://github.com/asottile/pyupgrade\n- rev: v3.15.2\n+ rev: v3.17.0\n hooks:\n - id: pyupgrade\n args: [--py38-plus]\n@@ -16,7 +16,7 @@ repos:\n hooks:\n - id: isort\n - repo: https://github.com/psf/black\n- rev: 24.4.2\n+ rev: 24.10.0\n hooks:\n - id: black\n - repo: https://github.com/collective/zpretty\n@@ -32,7 +32,7 @@ repos:\n # """\n ##\n - repo: https://github.com/PyCQA/flake8\n- rev: 7.0.0\n+ rev: 7.1.1\n hooks:\n - id: flake8\n \n@@ -71,7 +71,7 @@ repos:\n - id: check-python-versions\n args: [\'--only\', \'setup.py,pyproject.toml\']\n - repo: https://github.com/collective/i18ndude\n- rev: "6.2.0"\n+ rev: "6.2.1"\n hooks:\n - id: i18ndude\n \n' | ||
|