Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ftw.trash support für ftw.simplelayout content #53

Merged
merged 2 commits into from May 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions development.cfg
Expand Up @@ -3,6 +3,3 @@ extends =
test-plone-5.1.x.cfg
https://raw.github.com/4teamwork/ftw-buildouts/master/plone-development.cfg

[instance]
eggs +=
ftw.publisher.core [development]
2 changes: 1 addition & 1 deletion docs/HISTORY.txt
Expand Up @@ -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)
Expand Down
11 changes: 11 additions & 0 deletions ftw/publisher/core/adapters/simplelayout_utils.py
Expand Up @@ -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()


Expand All @@ -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
Expand Down
9 changes: 8 additions & 1 deletion ftw/publisher/core/tests/test_ftw_simplelayout_adapters.py
Expand Up @@ -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
Expand All @@ -23,7 +24,6 @@
import json



class TestSimplelayoutContentish(TestCase):
layer = PUBLISHER_CORE_INTEGRATION_TESTING

Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -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',
Expand Down