Skip to content
Permalink
Browse files

Add support for ftw.trash with ftw.simplelayout.

  • Loading branch information...
maethu committed May 6, 2019
1 parent 202ccfc commit 66d7fb3694534368502081fc44571994a953a528
@@ -5,7 +5,7 @@ Changelog
2.11.1 (unreleased)
-------------------

- Nothing changed yet.
- Add support for ftw.trash with simplelayout [mathias.leimgruber]


2.11.0 (2019-03-29)
@@ -37,6 +37,14 @@
pass


try:
pkg_resources.get_distribution('ftw.trash')
from ftw.trash.interfaces import ITrashed
HAS_FTW_TRASH = True
except pkg_resources.DistributionNotFound:
HAS_FTW_TRASH = False


marker = object()


@@ -62,6 +70,9 @@ def is_sl_contentish(context):
# Abort recursion when site root reached.
return False

if HAS_FTW_TRASH and ITrashed.providedBy(context):
return False

if filter(lambda x, c=context: x.providedBy(c), sl_pages):
# Abort recursion when simplelayout page reached.
return False
@@ -10,6 +10,7 @@
from ftw.simplelayout.interfaces import IBlockProperties
from ftw.simplelayout.interfaces import IPageConfiguration
from ftw.testing import staticuid
from ftw.trash.trasher import Trasher
from plone.app.testing import setRoles
from plone.app.testing import TEST_USER_ID
from plone.uuid.interfaces import IUUID
@@ -23,7 +24,6 @@
import json



class TestSimplelayoutContentish(TestCase):
layer = PUBLISHER_CORE_INTEGRATION_TESTING

@@ -43,6 +43,13 @@ def test_textblock_is_contentish(self):
.within(create(Builder('sl content page'))))
self.assertTrue(is_sl_contentish(block))

def test_trashed_textblock_is_not_sl_contentish(self):
block = create(Builder('sl textblock')
.within(create(Builder('sl content page'))))
trasher = Trasher(block)
trasher.trash()
self.assertFalse(is_sl_contentish(block))

def test_textblock_with_workflow_is_not_contentish(self):
wftool = getToolByName(self.portal, 'portal_workflow')
wftool.setChainForPortalTypes(
@@ -26,7 +26,7 @@
'collective.z3cform.datagridfield',
'ftw.builder',
'ftw.servicenavigation',
'ftw.simplelayout [contenttypes]',
'ftw.simplelayout [contenttypes, trash]',
'ftw.testing',
'plone.app.blob',
'plone.app.contenttypes',

0 comments on commit 66d7fb3

Please sign in to comment.
You can’t perform that action at this time.