Skip to content

Commit

Permalink
[fc] Repository: plone.app.contenttypes
Browse files Browse the repository at this point in the history
Branch: refs/heads/3.x
Date: 2024-11-18T11:39:46+01:00
Author: Yuri Carrer (yurj) <[email protected]>
Commit: plone/plone.app.contenttypes@7e3ce69

fix use of relative urls in replace_link_variables_by_paths and in the Link view

Files changed:
A news/712.bugfix
M plone/app/contenttypes/browser/link_redirect_view.py
M plone/app/contenttypes/utils.py
Repository: plone.app.contenttypes

Branch: refs/heads/3.x
Date: 2024-11-18T17:20:38+01:00
Author: Yuri (yurj) <[email protected]>
Commit: plone/plone.app.contenttypes@08dae55

Merge pull request #713 from plone/yurj-fix-relative-path

Fix use of relative urls in replace_link_variables_by_paths and in the Link view

Files changed:
A news/712.bugfix
M plone/app/contenttypes/browser/link_redirect_view.py
M plone/app/contenttypes/utils.py
  • Loading branch information
yurj committed Nov 18, 2024
1 parent 9df9a70 commit 97dd23b
Showing 1 changed file with 19 additions and 31 deletions.
50 changes: 19 additions & 31 deletions last_commit.txt
Original file line number Diff line number Diff line change
@@ -1,48 +1,36 @@
Repository: plone.app.dexterity
Repository: plone.app.contenttypes


Branch: refs/heads/3.x
Date: 2024-11-12T10:42:26+01:00
Author: 1letter (1letter) <[email protected]>
Commit: https://github.com/plone/plone.app.dexterity/commit/cf9f209f456fcea5801c6cb31ab80b3cc24649b6
Date: 2024-11-18T11:39:46+01:00
Author: Yuri Carrer (yurj) <[email protected]>
Commit: https://github.com/plone/plone.app.contenttypes/commit/7e3ce69b840286b3af2413e1b5ac3b2f949d1f6b

refactoring types robot test
fix use of relative urls in replace_link_variables_by_paths and in the Link view

Files changed:
M plone/app/dexterity/tests/robot/test_types.robot
A news/712.bugfix
M plone/app/contenttypes/browser/link_redirect_view.py
M plone/app/contenttypes/utils.py

b'diff --git a/plone/app/dexterity/tests/robot/test_types.robot b/plone/app/dexterity/tests/robot/test_types.robot\nindex 75fe47f7..c132518c 100644\n--- a/plone/app/dexterity/tests/robot/test_types.robot\n+++ b/plone/app/dexterity/tests/robot/test_types.robot\n@@ -1,35 +1,46 @@\n-*** Settings *****************************************************************\n+*** Settings ***\n \n-Resource plone/app/robotframework/keywords.robot\n-Resource plone/app/robotframework/saucelabs.robot\n-Resource plone/app/robotframework/selenium.robot\n+Resource plone/app/robotframework/browser.robot\n \n-Library Remote ${PLONE_URL}/RobotRemote\n+Library Remote ${PLONE_URL}/RobotRemote\n \n-Test Setup Run Keywords Plone test setup\n-Test Teardown Run keywords Plone test teardown\n+Test Setup Run Keywords Plone test setup\n+Test Teardown Run keywords Plone test teardown\n \n \n-*** Test cases ***************************************************************\n+*** Test cases ***\n \n Scenario: type title is normalized\n- Given a logged in manager\n- When adding a new content type\n- and type title is Bo\xc3\xaete \xc3\xa0 outils\n- Then type id should become boite_a_outils\n+ Given a site owner\n+ When adding a new content type\n+ and type title is Bo\xc3\xaete \xc3\xa0 outils\n+ Then type id should become boite_a_outils\n \n \n-*** Keywords *****************************************************************\n+*** Keywords ***\n+\n+# Given\n+\n+a site owner\n+\n+ Enable autologin as Manager\n+\n+# When\n \n adding a new content type\n- Go to ${PLONE_URL}/@@dexterity-types\n- Click Overlay Button Add New Content Type\xe2\x80\xa6\n+\n+ Go to ${PLONE_URL}/@@dexterity-types\n+ Click "Add New Content Type\xe2\x80\xa6"\n+\n+# Then\n \n type title is\n- [Arguments] ${title}\n- Input text form-widgets-title ${title}\n+ [Arguments] ${title}\n+\n+ Fill text //input[@id="form-widgets-title"] ${title}\n \n type id should become\n- [Arguments] ${id}\n- Set Focus To Element form-widgets-id\n- Wait until keyword succeeds 10 1 Textfield Value Should Be form-widgets-id ${id}\n+ [Arguments] ${id}\n+\n+ Focus id=form-widgets-id\n+ Get text //input[@id="form-widgets-id"] should be ${id}\n\\ No newline at end of file\n'
b'diff --git a/news/712.bugfix b/news/712.bugfix\nnew file mode 100644\nindex 00000000..d3051a5f\n--- /dev/null\n+++ b/news/712.bugfix\n@@ -0,0 +1 @@\n+[yurj] fix use of relative urls in replace_link_variables_by_paths and in the Link view\ndiff --git a/plone/app/contenttypes/browser/link_redirect_view.py b/plone/app/contenttypes/browser/link_redirect_view.py\nindex 645ee5b4..b4250df7 100644\n--- a/plone/app/contenttypes/browser/link_redirect_view.py\n+++ b/plone/app/contenttypes/browser/link_redirect_view.py\n@@ -111,9 +111,7 @@ def display_link(self):\n obj = uuidToObject(uid)\n if obj:\n title = obj.Title()\n- meta = "/".join(obj.getPhysicalPath()[2:])\n- if not meta.startswith("/"):\n- meta = "/" + meta\n+ meta = obj.absolute_url_path()\n return {\n "title": title,\n "meta": meta,\ndiff --git a/plone/app/contenttypes/utils.py b/plone/app/contenttypes/utils.py\nindex b4c89a3c..1e4ccde0 100644\n--- a/plone/app/contenttypes/utils.py\n+++ b/plone/app/contenttypes/utils.py\n@@ -48,7 +48,11 @@ def replace_link_variables_by_paths(context, url):\n \n \n def _replace_variable_by_path(url, variable, obj):\n- path = "/".join(obj.getPhysicalPath())\n+ path = obj.absolute_url_path()\n+ # if path is \'/\' (didn\'t happen with getPhysicalPath), avoid\n+ # ${navigation_root_url}/sitemap -> //sitemap\n+ if path == "/":\n+ path = ""\n return url.replace(variable, path)\n \n \n'

Repository: plone.app.dexterity
Repository: plone.app.contenttypes


Branch: refs/heads/3.x
Date: 2024-11-12T10:42:33+01:00
Author: 1letter (1letter) <[email protected]>
Commit: https://github.com/plone/plone.app.dexterity/commit/ac4f2611dcb5837840a65c1a9e788381daaaf056
Date: 2024-11-18T17:20:38+01:00
Author: Yuri (yurj) <[email protected]>
Commit: https://github.com/plone/plone.app.contenttypes/commit/08dae55fc9cd182aed9904153537ea7bffa1d719

add news
Merge pull request #713 from plone/yurj-fix-relative-path

Files changed:
A news/398.tests

b'diff --git a/news/398.tests b/news/398.tests\nnew file mode 100644\nindex 00000000..01eaa78c\n--- /dev/null\n+++ b/news/398.tests\n@@ -0,0 +1 @@\n+port robot tests, use browser library [1letter]\n'

Repository: plone.app.dexterity


Branch: refs/heads/3.x
Date: 2024-11-12T11:43:39+01:00
Author: Peter Mathis (petschki) <[email protected]>
Commit: https://github.com/plone/plone.app.dexterity/commit/8897203012f86fc2b9e1d8367d7242ef8f467748

Merge pull request #399 from plone/port-robot-tests-3.x

Port robot tests 3.x
Fix use of relative urls in replace_link_variables_by_paths and in the Link view

Files changed:
A news/398.tests
M plone/app/dexterity/tests/robot/test_types.robot
A news/712.bugfix
M plone/app/contenttypes/browser/link_redirect_view.py
M plone/app/contenttypes/utils.py

b'diff --git a/news/398.tests b/news/398.tests\nnew file mode 100644\nindex 00000000..01eaa78c\n--- /dev/null\n+++ b/news/398.tests\n@@ -0,0 +1 @@\n+port robot tests, use browser library [1letter]\ndiff --git a/plone/app/dexterity/tests/robot/test_types.robot b/plone/app/dexterity/tests/robot/test_types.robot\nindex 75fe47f7..c132518c 100644\n--- a/plone/app/dexterity/tests/robot/test_types.robot\n+++ b/plone/app/dexterity/tests/robot/test_types.robot\n@@ -1,35 +1,46 @@\n-*** Settings *****************************************************************\n+*** Settings ***\n \n-Resource plone/app/robotframework/keywords.robot\n-Resource plone/app/robotframework/saucelabs.robot\n-Resource plone/app/robotframework/selenium.robot\n+Resource plone/app/robotframework/browser.robot\n \n-Library Remote ${PLONE_URL}/RobotRemote\n+Library Remote ${PLONE_URL}/RobotRemote\n \n-Test Setup Run Keywords Plone test setup\n-Test Teardown Run keywords Plone test teardown\n+Test Setup Run Keywords Plone test setup\n+Test Teardown Run keywords Plone test teardown\n \n \n-*** Test cases ***************************************************************\n+*** Test cases ***\n \n Scenario: type title is normalized\n- Given a logged in manager\n- When adding a new content type\n- and type title is Bo\xc3\xaete \xc3\xa0 outils\n- Then type id should become boite_a_outils\n+ Given a site owner\n+ When adding a new content type\n+ and type title is Bo\xc3\xaete \xc3\xa0 outils\n+ Then type id should become boite_a_outils\n \n \n-*** Keywords *****************************************************************\n+*** Keywords ***\n+\n+# Given\n+\n+a site owner\n+\n+ Enable autologin as Manager\n+\n+# When\n \n adding a new content type\n- Go to ${PLONE_URL}/@@dexterity-types\n- Click Overlay Button Add New Content Type\xe2\x80\xa6\n+\n+ Go to ${PLONE_URL}/@@dexterity-types\n+ Click "Add New Content Type\xe2\x80\xa6"\n+\n+# Then\n \n type title is\n- [Arguments] ${title}\n- Input text form-widgets-title ${title}\n+ [Arguments] ${title}\n+\n+ Fill text //input[@id="form-widgets-title"] ${title}\n \n type id should become\n- [Arguments] ${id}\n- Set Focus To Element form-widgets-id\n- Wait until keyword succeeds 10 1 Textfield Value Should Be form-widgets-id ${id}\n+ [Arguments] ${id}\n+\n+ Focus id=form-widgets-id\n+ Get text //input[@id="form-widgets-id"] should be ${id}\n\\ No newline at end of file\n'
b'diff --git a/news/712.bugfix b/news/712.bugfix\nnew file mode 100644\nindex 00000000..d3051a5f\n--- /dev/null\n+++ b/news/712.bugfix\n@@ -0,0 +1 @@\n+[yurj] fix use of relative urls in replace_link_variables_by_paths and in the Link view\ndiff --git a/plone/app/contenttypes/browser/link_redirect_view.py b/plone/app/contenttypes/browser/link_redirect_view.py\nindex 645ee5b4..b4250df7 100644\n--- a/plone/app/contenttypes/browser/link_redirect_view.py\n+++ b/plone/app/contenttypes/browser/link_redirect_view.py\n@@ -111,9 +111,7 @@ def display_link(self):\n obj = uuidToObject(uid)\n if obj:\n title = obj.Title()\n- meta = "/".join(obj.getPhysicalPath()[2:])\n- if not meta.startswith("/"):\n- meta = "/" + meta\n+ meta = obj.absolute_url_path()\n return {\n "title": title,\n "meta": meta,\ndiff --git a/plone/app/contenttypes/utils.py b/plone/app/contenttypes/utils.py\nindex b4c89a3c..1e4ccde0 100644\n--- a/plone/app/contenttypes/utils.py\n+++ b/plone/app/contenttypes/utils.py\n@@ -48,7 +48,11 @@ def replace_link_variables_by_paths(context, url):\n \n \n def _replace_variable_by_path(url, variable, obj):\n- path = "/".join(obj.getPhysicalPath())\n+ path = obj.absolute_url_path()\n+ # if path is \'/\' (didn\'t happen with getPhysicalPath), avoid\n+ # ${navigation_root_url}/sitemap -> //sitemap\n+ if path == "/":\n+ path = ""\n return url.replace(variable, path)\n \n \n'

0 comments on commit 97dd23b

Please sign in to comment.