-
-
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/2.3.x Date: 2017-01-13T14:58:42+01:00 Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> Commit: plone/plone.app.layout@15156a4 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) <gil.gnome@gmail.com> Commit: plone/plone.app.layout@3f9516a 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
- Loading branch information
Showing
1 changed file
with
149 additions
and
37 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 |
---|---|---|
@@ -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) <vincent.fretin@gmail.com> | ||
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) <maurits@vanrees.org> | ||
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) <gil.gnome@gmail.com> | ||
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 | ||
|
||
|