-
-
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/master Date: 2024-11-11T10:03:24+01:00 Author: Peter Mathis (petschki) <[email protected]> Commit: plone/Products.CMFPlone@0d2ea6c Fix relative URI resources Files changed: M Products/CMFPlone/resources/browser/resource.py M Products/CMFPlone/tests/testResourceRegistries.py Repository: Products.CMFPlone Branch: refs/heads/master Date: 2024-11-11T10:03:24+01:00 Author: Peter Mathis (petschki) <[email protected]> Commit: plone/Products.CMFPlone@6998e8d changenote Files changed: A news/4049.bugfix Repository: Products.CMFPlone Branch: refs/heads/master Date: 2024-11-11T10:03:24+01:00 Author: Peter Mathis (petschki) <[email protected]> Commit: plone/Products.CMFPlone@b3bc44f change external_url check to static class method Files changed: M Products/CMFPlone/resources/browser/resource.py Repository: Products.CMFPlone Branch: refs/heads/master Date: 2024-11-11T10:57:34+01:00 Author: Peter Mathis (petschki) <[email protected]> Commit: plone/Products.CMFPlone@26c659a Merge pull request #4050 from plone/issue-4049 Fix relative URI resources Files changed: A news/4049.bugfix M Products/CMFPlone/resources/browser/resource.py M Products/CMFPlone/tests/testResourceRegistries.py
- Loading branch information
Showing
1 changed file
with
36 additions
and
19 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 |
---|---|---|
|
@@ -2,47 +2,64 @@ Repository: Products.CMFPlone | |
|
||
|
||
Branch: refs/heads/master | ||
Date: 2024-11-09T20:48:14+01:00 | ||
Author: 1letter (1letter) <[email protected]> | ||
Commit: https://github.com/plone/Products.CMFPlone/commit/4837ae7ec4f446527738e3c3169eb9ef3029be95 | ||
Date: 2024-11-11T10:03:24+01:00 | ||
Author: Peter Mathis (petschki) <[email protected]> | ||
Commit: https://github.com/plone/Products.CMFPlone/commit/0d2ea6ccba070e403a2fab44c9be240cf762410b | ||
|
||
add test scenario for contentbrowser | ||
Fix relative URI resources | ||
|
||
Files changed: | ||
M Products/CMFPlone/tests/robot/test_contentbrowser.robot | ||
M Products/CMFPlone/resources/browser/resource.py | ||
M Products/CMFPlone/tests/testResourceRegistries.py | ||
|
||
b'diff --git a/Products/CMFPlone/tests/robot/test_contentbrowser.robot b/Products/CMFPlone/tests/robot/test_contentbrowser.robot\nindex e370ffa17c..28190b084d 100644\n--- a/Products/CMFPlone/tests/robot/test_contentbrowser.robot\n+++ b/Products/CMFPlone/tests/robot/test_contentbrowser.robot\n@@ -16,6 +16,8 @@ Test Teardown Run keywords Plone Test Teardown\n \n ${ASSET_FOLDER} asset-folder\n ${DOCUMENT_ID} doc\n+${LINK_ID} internal-anchor\n+\n \n *** Test cases ***************************************************************\n \n@@ -66,6 +68,12 @@ Scenario: search and select an image via contentbrowser\n and I save the document\n Then the document contain the image by search\n \n+Scenario: add contenttype Link with an internal target\n+ Given a logged-in site administrator\n+ and a Link\n+ When I edit the Link\n+ Then the internal target is added\n+\n \n *** Keywords *****************************************************************\n \n@@ -107,6 +115,9 @@ a nested asset folder\n a document\n Create content type=Document id=${DOCUMENT_ID} title=My Page\n \n+a Link\n+ Create content type=Link id=${LINK_ID} title=My Link\n+\n # --- WHEN ------------------------------------------------------------------\n \n I select a related item image via contentbrowser\n@@ -215,7 +226,13 @@ I search and select an image via contentbrowser\n I save the document\n Click //button[@id="form-buttons-save"]\n \n-\n+I edit the Link\n+ Go to ${PLONE_URL}/${LINK_ID}/edit\n+ Click //div[contains(@class, "content-browser-selected-items")]/a\n+ # Click first element in first column, that is a folder\n+ Click item in contenbrowser column 1 1\n+ # Click the select Button in the Toolbar of column 2\n+ Click //div[contains(@class, "content-browser-wrapper")]//div[contains(@class, "levelColumns")]/div[2]/div[contains(@class, "levelToolbar")]/button\n \n # --- THEN ------------------------------------------------------------------\n \n@@ -239,6 +256,8 @@ the document contain the image by search\n the document contain the uploaded image\n rendered textfield contain the image with title plone-logo.png\n \n+the internal target is added\n+ Get Text //div[contains(@class, "content-browser-selected-items")]//span[@class="item-title"] should be Test Folder\n \n #--- Helper DRY -------------------------------------------------------------\n \n' | ||
b'diff --git a/Products/CMFPlone/resources/browser/resource.py b/Products/CMFPlone/resources/browser/resource.py\nindex 735a3460d0..6b23027200 100644\n--- a/Products/CMFPlone/resources/browser/resource.py\n+++ b/Products/CMFPlone/resources/browser/resource.py\n@@ -25,6 +25,13 @@\n }\n \n \n+def is_external_url(resource):\n+ # we check if the resource string starts with http and //\n+ # according to relative URI definition in\n+ # https://www.ietf.org/rfc/rfc3986.txt chapter 4.2\n+ return resource.startswith("http") or resource.startswith("//")\n+\n+\n class ResourceBase:\n """Information for script rendering.\n \n@@ -138,7 +145,7 @@ def check_dependencies(bundle_name, depends, bundles):\n depends = check_dependencies(name, record.depends, js_names)\n if depends == "__broken__":\n continue\n- external = record.jscompilation.startswith("http")\n+ external = is_external_url(record.jscompilation)\n PloneScriptResource(\n context=self.context,\n name=name,\n@@ -160,7 +167,7 @@ def check_dependencies(bundle_name, depends, bundles):\n depends = check_dependencies(name, record.depends, css_names)\n if depends == "__broken__":\n continue\n- external = record.csscompilation.startswith("http")\n+ external = is_external_url(record.csscompilation)\n PloneStyleResource(\n context=self.context,\n name=name,\n@@ -187,7 +194,7 @@ def check_dependencies(bundle_name, depends, bundles):\n # add Theme JS\n if themedata["production_js"]:\n # we ignore development_js for external detection\n- external = themedata["production_js"].startswith("http")\n+ external = is_external_url(themedata["production_js"])\n PloneScriptResource(\n context=self.context,\n name="theme",\n@@ -210,7 +217,7 @@ def check_dependencies(bundle_name, depends, bundles):\n # add Theme CSS\n if themedata["production_css"]:\n # we ignore development_css for external detection\n- external = themedata["production_css"].startswith("http")\n+ external = is_external_url(themedata["production_css"])\n PloneStyleResource(\n context=self.context,\n name="theme",\ndiff --git a/Products/CMFPlone/tests/testResourceRegistries.py b/Products/CMFPlone/tests/testResourceRegistries.py\nindex 235ba8cf87..3f3fbc0838 100644\n--- a/Products/CMFPlone/tests/testResourceRegistries.py\n+++ b/Products/CMFPlone/tests/testResourceRegistries.py\n@@ -207,6 +207,15 @@ def test_resource_bogus(self):\n resource.file_data, b\'I_do_not_exist\',\n )\n \n+ def test_relative_uri_resource(self):\n+ bundle = self._make_test_bundle()\n+ bundle.jscompilation = "//foo.bar/foobar.js"\n+ view = ScriptsView(self.app, self.app.REQUEST, None, None)\n+ view.update()\n+ results = view.render()\n+ self.assertIn(\'src="//foo.bar/foobar.js"\', results)\n+\n+\n class TestStylesViewlet(PloneTestCase.PloneTestCase):\n def test_styles_viewlet(self):\n styles = StylesView(self.layer["portal"], self.layer["request"], None)\n' | ||
|
||
Repository: Products.CMFPlone | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2024-11-09T20:48:14+01:00 | ||
Author: 1letter (1letter) <[email protected]> | ||
Commit: https://github.com/plone/Products.CMFPlone/commit/6fb73e8a7271160b9ea1f53b09d671625bf56b52 | ||
Date: 2024-11-11T10:03:24+01:00 | ||
Author: Peter Mathis (petschki) <[email protected]> | ||
Commit: https://github.com/plone/Products.CMFPlone/commit/6998e8db88adb2a156094a87e9abe3434b716253 | ||
|
||
add news | ||
changenote | ||
|
||
Files changed: | ||
A news/4043.tests | ||
A news/4049.bugfix | ||
|
||
b'diff --git a/news/4043.tests b/news/4043.tests\nnew file mode 100644\nindex 0000000000..3f1439ebd3\n--- /dev/null\n+++ b/news/4043.tests\n@@ -0,0 +1,2 @@\n+add robot test scenario for contentbrowser widget\n+[1letter]\n' | ||
b'diff --git a/news/4049.bugfix b/news/4049.bugfix\nnew file mode 100644\nindex 0000000000..eeafacf34f\n--- /dev/null\n+++ b/news/4049.bugfix\n@@ -0,0 +1,2 @@\n+Fix resources with relative URI in registry.\n+[petschki]\n' | ||
|
||
Repository: Products.CMFPlone | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2024-11-11T09:52:54+01:00 | ||
Date: 2024-11-11T10:03:24+01:00 | ||
Author: Peter Mathis (petschki) <[email protected]> | ||
Commit: https://github.com/plone/Products.CMFPlone/commit/b3bc44f1d03581b42d4343d75f05f289a3f2bd0b | ||
|
||
change external_url check to static class method | ||
|
||
Files changed: | ||
M Products/CMFPlone/resources/browser/resource.py | ||
|
||
b'diff --git a/Products/CMFPlone/resources/browser/resource.py b/Products/CMFPlone/resources/browser/resource.py\nindex 6b23027200..aba363c73d 100644\n--- a/Products/CMFPlone/resources/browser/resource.py\n+++ b/Products/CMFPlone/resources/browser/resource.py\n@@ -25,13 +25,6 @@\n }\n \n \n-def is_external_url(resource):\n- # we check if the resource string starts with http and //\n- # according to relative URI definition in\n- # https://www.ietf.org/rfc/rfc3986.txt chapter 4.2\n- return resource.startswith("http") or resource.startswith("//")\n-\n-\n class ResourceBase:\n """Information for script rendering.\n \n@@ -40,6 +33,13 @@ class ResourceBase:\n initialization.\n """\n \n+ @staticmethod\n+ def is_external_url(resource):\n+ # we check if the resource string starts with http and //\n+ # according to relative URI definition in\n+ # https://www.ietf.org/rfc/rfc3986.txt chapter 4.2\n+ return resource.startswith("http") or resource.startswith("//")\n+\n def _request_bundles(self):\n request = self.request\n request_enabled_bundles = set(getattr(request, "enabled_bundles", []))\n@@ -145,7 +145,7 @@ def check_dependencies(bundle_name, depends, bundles):\n depends = check_dependencies(name, record.depends, js_names)\n if depends == "__broken__":\n continue\n- external = is_external_url(record.jscompilation)\n+ external = self.is_external_url(record.jscompilation)\n PloneScriptResource(\n context=self.context,\n name=name,\n@@ -167,7 +167,7 @@ def check_dependencies(bundle_name, depends, bundles):\n depends = check_dependencies(name, record.depends, css_names)\n if depends == "__broken__":\n continue\n- external = is_external_url(record.csscompilation)\n+ external = self.is_external_url(record.csscompilation)\n PloneStyleResource(\n context=self.context,\n name=name,\n@@ -194,7 +194,7 @@ def check_dependencies(bundle_name, depends, bundles):\n # add Theme JS\n if themedata["production_js"]:\n # we ignore development_js for external detection\n- external = is_external_url(themedata["production_js"])\n+ external = self.is_external_url(themedata["production_js"])\n PloneScriptResource(\n context=self.context,\n name="theme",\n@@ -217,7 +217,7 @@ def check_dependencies(bundle_name, depends, bundles):\n # add Theme CSS\n if themedata["production_css"]:\n # we ignore development_css for external detection\n- external = is_external_url(themedata["production_css"])\n+ external = self.is_external_url(themedata["production_css"])\n PloneStyleResource(\n context=self.context,\n name="theme",\n' | ||
|
||
Repository: Products.CMFPlone | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2024-11-11T10:57:34+01:00 | ||
Author: Peter Mathis (petschki) <[email protected]> | ||
Commit: https://github.com/plone/Products.CMFPlone/commit/ba15fc5323fe405274844359c04333a76cd92342 | ||
Commit: https://github.com/plone/Products.CMFPlone/commit/26c659aaad12ce59376d3d79ca12b2d1128fa38a | ||
|
||
Merge pull request #4053 from plone/more-contentbrowser-tests | ||
Merge pull request #4050 from plone/issue-4049 | ||
|
||
add test scenario for contentbrowser | ||
Fix relative URI resources | ||
|
||
Files changed: | ||
A news/4043.tests | ||
M Products/CMFPlone/tests/robot/test_contentbrowser.robot | ||
A news/4049.bugfix | ||
M Products/CMFPlone/resources/browser/resource.py | ||
M Products/CMFPlone/tests/testResourceRegistries.py | ||
|
||
b'diff --git a/Products/CMFPlone/tests/robot/test_contentbrowser.robot b/Products/CMFPlone/tests/robot/test_contentbrowser.robot\nindex e370ffa17c..28190b084d 100644\n--- a/Products/CMFPlone/tests/robot/test_contentbrowser.robot\n+++ b/Products/CMFPlone/tests/robot/test_contentbrowser.robot\n@@ -16,6 +16,8 @@ Test Teardown Run keywords Plone Test Teardown\n \n ${ASSET_FOLDER} asset-folder\n ${DOCUMENT_ID} doc\n+${LINK_ID} internal-anchor\n+\n \n *** Test cases ***************************************************************\n \n@@ -66,6 +68,12 @@ Scenario: search and select an image via contentbrowser\n and I save the document\n Then the document contain the image by search\n \n+Scenario: add contenttype Link with an internal target\n+ Given a logged-in site administrator\n+ and a Link\n+ When I edit the Link\n+ Then the internal target is added\n+\n \n *** Keywords *****************************************************************\n \n@@ -107,6 +115,9 @@ a nested asset folder\n a document\n Create content type=Document id=${DOCUMENT_ID} title=My Page\n \n+a Link\n+ Create content type=Link id=${LINK_ID} title=My Link\n+\n # --- WHEN ------------------------------------------------------------------\n \n I select a related item image via contentbrowser\n@@ -215,7 +226,13 @@ I search and select an image via contentbrowser\n I save the document\n Click //button[@id="form-buttons-save"]\n \n-\n+I edit the Link\n+ Go to ${PLONE_URL}/${LINK_ID}/edit\n+ Click //div[contains(@class, "content-browser-selected-items")]/a\n+ # Click first element in first column, that is a folder\n+ Click item in contenbrowser column 1 1\n+ # Click the select Button in the Toolbar of column 2\n+ Click //div[contains(@class, "content-browser-wrapper")]//div[contains(@class, "levelColumns")]/div[2]/div[contains(@class, "levelToolbar")]/button\n \n # --- THEN ------------------------------------------------------------------\n \n@@ -239,6 +256,8 @@ the document contain the image by search\n the document contain the uploaded image\n rendered textfield contain the image with title plone-logo.png\n \n+the internal target is added\n+ Get Text //div[contains(@class, "content-browser-selected-items")]//span[@class="item-title"] should be Test Folder\n \n #--- Helper DRY -------------------------------------------------------------\n \ndiff --git a/news/4043.tests b/news/4043.tests\nnew file mode 100644\nindex 0000000000..3f1439ebd3\n--- /dev/null\n+++ b/news/4043.tests\n@@ -0,0 +1,2 @@\n+add robot test scenario for contentbrowser widget\n+[1letter]\n' | ||
b'diff --git a/Products/CMFPlone/resources/browser/resource.py b/Products/CMFPlone/resources/browser/resource.py\nindex 735a3460d0..aba363c73d 100644\n--- a/Products/CMFPlone/resources/browser/resource.py\n+++ b/Products/CMFPlone/resources/browser/resource.py\n@@ -33,6 +33,13 @@ class ResourceBase:\n initialization.\n """\n \n+ @staticmethod\n+ def is_external_url(resource):\n+ # we check if the resource string starts with http and //\n+ # according to relative URI definition in\n+ # https://www.ietf.org/rfc/rfc3986.txt chapter 4.2\n+ return resource.startswith("http") or resource.startswith("//")\n+\n def _request_bundles(self):\n request = self.request\n request_enabled_bundles = set(getattr(request, "enabled_bundles", []))\n@@ -138,7 +145,7 @@ def check_dependencies(bundle_name, depends, bundles):\n depends = check_dependencies(name, record.depends, js_names)\n if depends == "__broken__":\n continue\n- external = record.jscompilation.startswith("http")\n+ external = self.is_external_url(record.jscompilation)\n PloneScriptResource(\n context=self.context,\n name=name,\n@@ -160,7 +167,7 @@ def check_dependencies(bundle_name, depends, bundles):\n depends = check_dependencies(name, record.depends, css_names)\n if depends == "__broken__":\n continue\n- external = record.csscompilation.startswith("http")\n+ external = self.is_external_url(record.csscompilation)\n PloneStyleResource(\n context=self.context,\n name=name,\n@@ -187,7 +194,7 @@ def check_dependencies(bundle_name, depends, bundles):\n # add Theme JS\n if themedata["production_js"]:\n # we ignore development_js for external detection\n- external = themedata["production_js"].startswith("http")\n+ external = self.is_external_url(themedata["production_js"])\n PloneScriptResource(\n context=self.context,\n name="theme",\n@@ -210,7 +217,7 @@ def check_dependencies(bundle_name, depends, bundles):\n # add Theme CSS\n if themedata["production_css"]:\n # we ignore development_css for external detection\n- external = themedata["production_css"].startswith("http")\n+ external = self.is_external_url(themedata["production_css"])\n PloneStyleResource(\n context=self.context,\n name="theme",\ndiff --git a/Products/CMFPlone/tests/testResourceRegistries.py b/Products/CMFPlone/tests/testResourceRegistries.py\nindex 235ba8cf87..3f3fbc0838 100644\n--- a/Products/CMFPlone/tests/testResourceRegistries.py\n+++ b/Products/CMFPlone/tests/testResourceRegistries.py\n@@ -207,6 +207,15 @@ def test_resource_bogus(self):\n resource.file_data, b\'I_do_not_exist\',\n )\n \n+ def test_relative_uri_resource(self):\n+ bundle = self._make_test_bundle()\n+ bundle.jscompilation = "//foo.bar/foobar.js"\n+ view = ScriptsView(self.app, self.app.REQUEST, None, None)\n+ view.update()\n+ results = view.render()\n+ self.assertIn(\'src="//foo.bar/foobar.js"\', results)\n+\n+\n class TestStylesViewlet(PloneTestCase.PloneTestCase):\n def test_styles_viewlet(self):\n styles = StylesView(self.layer["portal"], self.layer["request"], None)\ndiff --git a/news/4049.bugfix b/news/4049.bugfix\nnew file mode 100644\nindex 0000000000..eeafacf34f\n--- /dev/null\n+++ b/news/4049.bugfix\n@@ -0,0 +1,2 @@\n+Fix resources with relative URI in registry.\n+[petschki]\n' | ||
|