diff --git a/news/550.bugfix b/news/550.bugfix new file mode 100644 index 000000000..34a5d69c6 --- /dev/null +++ b/news/550.bugfix @@ -0,0 +1,2 @@ +Fix "replace link variable by path" indexer to return an url and not a path. +[bsuttor] diff --git a/plone/app/contenttypes/tests/test_indexes.py b/plone/app/contenttypes/tests/test_indexes.py index e10eef5df..77b7218db 100644 --- a/plone/app/contenttypes/tests/test_indexes.py +++ b/plone/app/contenttypes/tests/test_indexes.py @@ -356,7 +356,7 @@ def test_get_remote_url_in_metadata_variables_replaced(self): )) self.assertEqual( brains[0].getRemoteUrl, - '/plone/my-item' + 'http://nohost/plone/my-item' ) def test_getobjsize_image(self): diff --git a/plone/app/contenttypes/tests/test_link.py b/plone/app/contenttypes/tests/test_link.py index 5f729ba21..57a182d8f 100644 --- a/plone/app/contenttypes/tests/test_link.py +++ b/plone/app/contenttypes/tests/test_link.py @@ -373,9 +373,9 @@ def test_var_replacement_in_view(self): ) self.link.remoteUrl = '${portal_url}' - self.assertEqual(view.url(), '/plone') + self.assertEqual(view.url(), 'http://nohost/plone') self.assertEqual(view.absolute_target_url(), 'http://nohost/plone') self.link.remoteUrl = '${navigation_root_url}' - self.assertEqual(view.url(), '/plone') + self.assertEqual(view.url(), 'http://nohost/plone') self.assertEqual(view.absolute_target_url(), 'http://nohost/plone') diff --git a/plone/app/contenttypes/utils.py b/plone/app/contenttypes/utils.py index 262fac814..b18e8f64f 100644 --- a/plone/app/contenttypes/utils.py +++ b/plone/app/contenttypes/utils.py @@ -40,5 +40,5 @@ def replace_link_variables_by_paths(context, url): def _replace_variable_by_path(url, variable, obj): - path = '/'.join(obj.getPhysicalPath()) + path = obj.absolute_url() return url.replace(variable, path)