diff --git a/last_commit.txt b/last_commit.txt index c93e9368e8..050cdabf4a 100644 --- a/last_commit.txt +++ b/last_commit.txt @@ -1,88 +1,128 @@ -Repository: archetypes.referencebrowserwidget +Repository: plone.app.linkintegrity -Branch: refs/heads/master -Date: 2016-01-20T03:06:17+01:00 -Author: Johannes Raggam (thet) -Commit: https://github.com/plone/archetypes.referencebrowserwidget/commit/f28c9fcf1f70946b997721baeb372667a1e880fc +Branch: refs/heads/1.5.x +Date: 2016-01-21T17:00:24+01:00 +Author: tschorr (tschorr) +Commit: https://github.com/plone/plone.app.linkintegrity/commit/16639ddff0849653abc33a9bc0d3b22ae3d34266 -Update to work with new plone.batching pagination selector as well asl with old one. +fix findObjects for the case where the webserver rewrites the portal name Files changed: M CHANGES.rst -M src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js +M plone/app/linkintegrity/handlers.py +M plone/app/linkintegrity/tests/test_handlers.py diff --git a/CHANGES.rst b/CHANGES.rst -index a59cb46..8fe07f5 100644 +index 779b21d..52cedcd 100644 --- a/CHANGES.rst +++ b/CHANGES.rst -@@ -12,6 +12,9 @@ Fixes: +@@ -12,7 +12,8 @@ New: + Fixes: - - Fix to work with Plone 5 + - *add item here* +- ++- make handler.findObject() work when the webserver rewrites the portal name ++ [tschorr] -+- Update to work with new plone.batching "pagination" selector as well asl with old one. -+ [thet] -+ - - 2.5.6 (2015-11-27) + 1.5.7 (2015-11-17) ------------------ -diff --git a/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js b/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js -index cfea8e4..13d5bf8 100644 ---- a/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js -+++ b/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js -@@ -103,7 +103,7 @@ jQuery(function ($) { - }); - - // the pagination links -- $(document).on('click', '[id^=atrb_] .listingBar a', function (event) { -+ $(document).on('click', '[id^=atrb_] .listingBar a, [id^=atrb_] .pagination a', function (event) { - var target = $(this); - var src = target.attr('href'); - var wrap = target.parents('.overlaycontent'); +diff --git a/plone/app/linkintegrity/handlers.py b/plone/app/linkintegrity/handlers.py +index 2841dbc..b1f4426 100644 +--- a/plone/app/linkintegrity/handlers.py ++++ b/plone/app/linkintegrity/handlers.py +@@ -65,7 +65,7 @@ def findObject(base, path): + if path.startswith('/'): + # Make an absolute path relative to the portal root + obj = getToolByName(base, 'portal_url').getPortalObject() +- portal_path = '/'.join(obj.getPhysicalPath()) + '/' ++ portal_path = obj.absolute_url_path() + '/' + if path.startswith(portal_path): + path = path[len(portal_path):] + else: +diff --git a/plone/app/linkintegrity/tests/test_handlers.py b/plone/app/linkintegrity/tests/test_handlers.py +index 79652ff..9891837 100644 +--- a/plone/app/linkintegrity/tests/test_handlers.py ++++ b/plone/app/linkintegrity/tests/test_handlers.py +@@ -23,3 +23,14 @@ def test_relative_to_portal_root_2(self): + obj, components = findObject(self.portal.doc1, '/doc2') + self.assertEqual(obj.absolute_url_path(), '/plone/doc2') + self.assertEqual(components, '') ++ ++ def test_webserver_rewrites_portal_name(self): ++ # test the case where a webserver rewrites the portal name, e.g. for Apache: ++ # RewriteRule ^/wssitename(.*)$ http://localhost:8080/VirtualHostBase/http/my.domain.com:80/plonesitename/VirtualHostRoot/_vh_wssitename$1 ++ self.portal.REQUEST.other['VirtualRootPhysicalPath'] = ('', 'plone') ++ self.portal.REQUEST._script = ['plone_foo'] ++ obj, components = findObject(self.portal.doc1, '/plone_foo/doc2') ++ self.assertEqual(obj.absolute_url_path(), '/plone_foo/doc2') ++ self.assertEqual(obj.getPhysicalPath(), ('','plone', 'doc2')) ++ self.assertEqual(components, '') ++ -Repository: archetypes.referencebrowserwidget +Repository: plone.app.linkintegrity -Branch: refs/heads/master -Date: 2016-01-21T11:15:40+01:00 -Author: agitator (agitator) -Commit: https://github.com/plone/archetypes.referencebrowserwidget/commit/3b1f725e62ed373a7cd67683505cd27e5b6b2f68 +Branch: refs/heads/1.5.x +Date: 2016-01-22T12:12:40+01:00 +Author: Philip Bauer (pbauer) +Commit: https://github.com/plone/plone.app.linkintegrity/commit/564b676f0e6d3347939a7d4fa7d4549f1a047ff4 -Merge pull request #32 from plone/pagination_markup +Merge pull request #34 from plone/rewritten_portal_name_1.5.x_pr -Update to work with new plone.batching pagination selector +Make findObject work if the webserver rewrites the portal name Files changed: M CHANGES.rst -M src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js +M plone/app/linkintegrity/handlers.py +M plone/app/linkintegrity/tests/test_handlers.py diff --git a/CHANGES.rst b/CHANGES.rst -index a59cb46..8fe07f5 100644 +index 779b21d..52cedcd 100644 --- a/CHANGES.rst +++ b/CHANGES.rst -@@ -12,6 +12,9 @@ Fixes: +@@ -12,7 +12,8 @@ New: + Fixes: - - Fix to work with Plone 5 + - *add item here* +- ++- make handler.findObject() work when the webserver rewrites the portal name ++ [tschorr] -+- Update to work with new plone.batching "pagination" selector as well asl with old one. -+ [thet] -+ - - 2.5.6 (2015-11-27) + 1.5.7 (2015-11-17) ------------------ -diff --git a/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js b/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js -index cfea8e4..13d5bf8 100644 ---- a/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js -+++ b/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js -@@ -103,7 +103,7 @@ jQuery(function ($) { - }); - - // the pagination links -- $(document).on('click', '[id^=atrb_] .listingBar a', function (event) { -+ $(document).on('click', '[id^=atrb_] .listingBar a, [id^=atrb_] .pagination a', function (event) { - var target = $(this); - var src = target.attr('href'); - var wrap = target.parents('.overlaycontent'); +diff --git a/plone/app/linkintegrity/handlers.py b/plone/app/linkintegrity/handlers.py +index 2841dbc..b1f4426 100644 +--- a/plone/app/linkintegrity/handlers.py ++++ b/plone/app/linkintegrity/handlers.py +@@ -65,7 +65,7 @@ def findObject(base, path): + if path.startswith('/'): + # Make an absolute path relative to the portal root + obj = getToolByName(base, 'portal_url').getPortalObject() +- portal_path = '/'.join(obj.getPhysicalPath()) + '/' ++ portal_path = obj.absolute_url_path() + '/' + if path.startswith(portal_path): + path = path[len(portal_path):] + else: +diff --git a/plone/app/linkintegrity/tests/test_handlers.py b/plone/app/linkintegrity/tests/test_handlers.py +index 79652ff..9891837 100644 +--- a/plone/app/linkintegrity/tests/test_handlers.py ++++ b/plone/app/linkintegrity/tests/test_handlers.py +@@ -23,3 +23,14 @@ def test_relative_to_portal_root_2(self): + obj, components = findObject(self.portal.doc1, '/doc2') + self.assertEqual(obj.absolute_url_path(), '/plone/doc2') + self.assertEqual(components, '') ++ ++ def test_webserver_rewrites_portal_name(self): ++ # test the case where a webserver rewrites the portal name, e.g. for Apache: ++ # RewriteRule ^/wssitename(.*)$ http://localhost:8080/VirtualHostBase/http/my.domain.com:80/plonesitename/VirtualHostRoot/_vh_wssitename$1 ++ self.portal.REQUEST.other['VirtualRootPhysicalPath'] = ('', 'plone') ++ self.portal.REQUEST._script = ['plone_foo'] ++ obj, components = findObject(self.portal.doc1, '/plone_foo/doc2') ++ self.assertEqual(obj.absolute_url_path(), '/plone_foo/doc2') ++ self.assertEqual(obj.getPhysicalPath(), ('','plone', 'doc2')) ++ self.assertEqual(components, '') ++