From 45ea8c6b54f7b7de5f8c2af2461807c81fdb812b Mon Sep 17 00:00:00 2001 From: gforcada Date: Fri, 13 Jan 2017 20:41:23 +0100 Subject: [PATCH] [fc] Repository: plone.app.layout Branch: refs/heads/2.3.x Date: 2017-01-13T14:58:42+01:00 Author: Maurits van Rees (mauritsvanrees) Commit: https://github.com/plone/plone.app.layout/commit/15156a4e7970bce7cf47351c29dab63dad0d1eaa Fix error in viewlet when related dexterity item has been deleted. Files changed: M CHANGES.rst M plone/app/layout/viewlets/content.py M plone/app/layout/viewlets/tests/test_content.py Repository: plone.app.layout Branch: refs/heads/2.3.x Date: 2017-01-13T20:41:23+01:00 Author: Gil Forcada Codinachs (gforcada) Commit: https://github.com/plone/plone.app.layout/commit/3f9516af97997821b658ab3f64d5050e3a8089d6 Merge pull request #114 from plone/fix-deleted-related-dexterity-item-23 Fix error in viewlet when related dexterity item has been deleted. [2.3.x] Files changed: M CHANGES.rst M plone/app/layout/viewlets/content.py M plone/app/layout/viewlets/tests/test_content.py --- last_commit.txt | 186 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 149 insertions(+), 37 deletions(-) diff --git a/last_commit.txt b/last_commit.txt index 21f6a16c2e..f0e2c96aa0 100644 --- a/last_commit.txt +++ b/last_commit.txt @@ -1,54 +1,166 @@ -Repository: Products.TinyMCE +Repository: plone.app.layout -Branch: refs/heads/1.3.x -Date: 2017-01-13T15:08:10+01:00 -Author: Vincent Fretin (vincentfretin) -Commit: https://github.com/plone/Products.TinyMCE/commit/66989447b6b50873d1bc2de5c2cfef7602bc16a0 +Branch: refs/heads/2.3.x +Date: 2017-01-13T14:58:42+01:00 +Author: Maurits van Rees (mauritsvanrees) +Commit: https://github.com/plone/plone.app.layout/commit/15156a4e7970bce7cf47351c29dab63dad0d1eaa -Allow HTML 5.1 allowfullscreen attribute for iframe. This is needed for some embed videos to allow full screen functionality. +Fix error in viewlet when related dexterity item has been deleted. Files changed: M CHANGES.rst -M Products/TinyMCE/utility.py +M plone/app/layout/viewlets/content.py +M plone/app/layout/viewlets/tests/test_content.py diff --git a/CHANGES.rst b/CHANGES.rst -index 39e5706..8bff6de 100644 +index a53be63..52f8f9b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst -@@ -5,17 +5,11 @@ HISTORY - 1.3.25 (unreleased) - ------------------- +@@ -14,7 +14,8 @@ New features: + + Bug fixes: --Breaking changes: -- --- *add item here* -- --New features: -- -- *add item here* -- ++- Fix error in viewlet when related dexterity item has been deleted. ++ [maurits] + + + 2.3.16 (2016-12-19) +diff --git a/plone/app/layout/viewlets/content.py b/plone/app/layout/viewlets/content.py +index 83b8c92..7892997 100644 +--- a/plone/app/layout/viewlets/content.py ++++ b/plone/app/layout/viewlets/content.py +@@ -176,6 +176,10 @@ def related2brains(self, related): + brains = [] + for r in related: + path = r.to_path ++ if path is None: ++ # Item was deleted. The related item should have been cleaned ++ # up, but apparently this does not happen. ++ continue + # the query will return an empty list if the user has no + # permission to see the target object + brains.extend(catalog(path=dict(query=path, depth=0))) +diff --git a/plone/app/layout/viewlets/tests/test_content.py b/plone/app/layout/viewlets/tests/test_content.py +index 3bf71bc..04b3f58 100644 +--- a/plone/app/layout/viewlets/tests/test_content.py ++++ b/plone/app/layout/viewlets/tests/test_content.py +@@ -106,6 +106,15 @@ def testRelatedItems(self): + related = viewlet.related_items() + self.assertEqual([x.Title for x in related], ['Document 2', 'Document 3']) + ++ def testDeletedRelatedItems(self): ++ # Deleted related items should not cause problems. ++ self.folder._delObject('doc2') ++ request = self.app.REQUEST ++ viewlet = ContentRelatedItems(self.folder.doc1, request, None, None) ++ viewlet.update() ++ related = viewlet.related_items() ++ self.assertEqual([x.Title for x in related], ['Document 3']) ++ + + class TestDexterityRelatedItemsViewlet(ViewletsTestCase): + +@@ -174,6 +183,15 @@ def testDexterityFolderRelatedItems(self): + related = viewlet.related_items() + self.assertEqual(len(related), 1) + ++ def testDexterityDeletedRelatedItems(self): ++ # Deleted related items should not cause problems. ++ self.folder._delObject('doc1') ++ request = self.app.REQUEST ++ viewlet = ContentRelatedItems(self.folder.dex1, request, None, None) ++ viewlet.update() ++ related = viewlet.related_items() ++ self.assertEqual([x.id for x in related], ['doc2']) ++ + + def test_suite(): + from unittest import defaultTestLoader + + +Repository: plone.app.layout + + +Branch: refs/heads/2.3.x +Date: 2017-01-13T20:41:23+01:00 +Author: Gil Forcada Codinachs (gforcada) +Commit: https://github.com/plone/plone.app.layout/commit/3f9516af97997821b658ab3f64d5050e3a8089d6 + +Merge pull request #114 from plone/fix-deleted-related-dexterity-item-23 + +Fix error in viewlet when related dexterity item has been deleted. [2.3.x] + +Files changed: +M CHANGES.rst +M plone/app/layout/viewlets/content.py +M plone/app/layout/viewlets/tests/test_content.py + +diff --git a/CHANGES.rst b/CHANGES.rst +index a53be63..52f8f9b 100644 +--- a/CHANGES.rst ++++ b/CHANGES.rst +@@ -14,7 +14,8 @@ New features: + Bug fixes: -- *add item here* -+- Allow HTML 5.1 allowfullscreen attribute for iframe. This is needed for -+ some embed videos to allow full screen functionality. -+ [vincentfretin] - - - 1.3.24 (2016-11-09) -diff --git a/Products/TinyMCE/utility.py b/Products/TinyMCE/utility.py -index 0030498..44e1cf4 100644 ---- a/Products/TinyMCE/utility.py -+++ b/Products/TinyMCE/utility.py -@@ -493,7 +493,7 @@ def getValidElements(self): - 'tt': COMMON_ATTRS.copy(), - 'ul': COMMON_ATTRS | set('compact type'.split()), - 'var': COMMON_ATTRS.copy(), -- 'iframe': COMMON_ATTRS | set('src name scrolling frameborder longdesc align height width marginheight marginwidth'.split()) -+ 'iframe': COMMON_ATTRS | set('src name scrolling frameborder longdesc align height width marginheight marginwidth allowfullscreen'.split()) - } - - # Get custom tags ++- Fix error in viewlet when related dexterity item has been deleted. ++ [maurits] + + + 2.3.16 (2016-12-19) +diff --git a/plone/app/layout/viewlets/content.py b/plone/app/layout/viewlets/content.py +index 83b8c92..7892997 100644 +--- a/plone/app/layout/viewlets/content.py ++++ b/plone/app/layout/viewlets/content.py +@@ -176,6 +176,10 @@ def related2brains(self, related): + brains = [] + for r in related: + path = r.to_path ++ if path is None: ++ # Item was deleted. The related item should have been cleaned ++ # up, but apparently this does not happen. ++ continue + # the query will return an empty list if the user has no + # permission to see the target object + brains.extend(catalog(path=dict(query=path, depth=0))) +diff --git a/plone/app/layout/viewlets/tests/test_content.py b/plone/app/layout/viewlets/tests/test_content.py +index 3bf71bc..04b3f58 100644 +--- a/plone/app/layout/viewlets/tests/test_content.py ++++ b/plone/app/layout/viewlets/tests/test_content.py +@@ -106,6 +106,15 @@ def testRelatedItems(self): + related = viewlet.related_items() + self.assertEqual([x.Title for x in related], ['Document 2', 'Document 3']) + ++ def testDeletedRelatedItems(self): ++ # Deleted related items should not cause problems. ++ self.folder._delObject('doc2') ++ request = self.app.REQUEST ++ viewlet = ContentRelatedItems(self.folder.doc1, request, None, None) ++ viewlet.update() ++ related = viewlet.related_items() ++ self.assertEqual([x.Title for x in related], ['Document 3']) ++ + + class TestDexterityRelatedItemsViewlet(ViewletsTestCase): + +@@ -174,6 +183,15 @@ def testDexterityFolderRelatedItems(self): + related = viewlet.related_items() + self.assertEqual(len(related), 1) + ++ def testDexterityDeletedRelatedItems(self): ++ # Deleted related items should not cause problems. ++ self.folder._delObject('doc1') ++ request = self.app.REQUEST ++ viewlet = ContentRelatedItems(self.folder.dex1, request, None, None) ++ viewlet.update() ++ related = viewlet.related_items() ++ self.assertEqual([x.id for x in related], ['doc2']) ++ + + def test_suite(): + from unittest import defaultTestLoader