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

Removed folder_publish.cpy script. #3184

Merged
merged 1 commit into from
Sep 28, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions Products/CMFPlone/PloneTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -1008,44 +1008,6 @@ def deleteObjectsByPaths(self, paths, handle_errors=True, REQUEST=None):
return success, failure
deleteObjectsByPaths = postonly(deleteObjectsByPaths)

@security.public
def transitionObjectsByPaths(self, workflow_action, paths, comment='',
expiration_date=None, effective_date=None,
include_children=False, handle_errors=True,
REQUEST=None):
log_deprecated("transitionObjectsByPaths is deprecated")
failure = {}
# use the portal for traversal in case we have relative paths
portal = getToolByName(self, 'portal_url').getPortalObject()
traverse = portal.restrictedTraverse
for path in paths:
if handle_errors:
sp = transaction.savepoint(optimistic=True)
try:
o = traverse(path, None)
if o is not None:
o.content_status_modify(workflow_action,
comment,
effective_date=effective_date,
expiration_date=expiration_date)
except ConflictError:
raise
except Exception as e:
if handle_errors:
# skip this object but continue with sub-objects.
sp.rollback()
failure[path] = e
else:
raise
if getattr(o, 'isPrincipiaFolderish', None) and include_children:
subobject_paths = ["%s/%s" % (path, id) for id in o]
self.transitionObjectsByPaths(workflow_action, subobject_paths,
comment, expiration_date,
effective_date, include_children,
handle_errors)
return failure
transitionObjectsByPaths = postonly(transitionObjectsByPaths)

@security.public
def renameObjectsByPaths(self, paths, new_ids, new_titles,
handle_errors=True, REQUEST=None):
Expand Down
1 change: 0 additions & 1 deletion Products/CMFPlone/patches/csrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def applyPatches():
PT.changeOwnershipOf = patch(PT.changeOwnershipOf)
PT.acquireLocalRoles = patch(PT.acquireLocalRoles)
PT.deleteObjectsByPaths = patch(PT.deleteObjectsByPaths)
PT.transitionObjectsByPaths = patch(PT.transitionObjectsByPaths)
PT.renameObjectsByPaths = patch(PT.renameObjectsByPaths)

from Products.CMFCore.MembershipTool import MembershipTool as MT
Expand Down
35 changes: 0 additions & 35 deletions Products/CMFPlone/skins/plone_scripts/folder_publish.cpy

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions Products/CMFPlone/tests/testCSRFProtection.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,6 @@ def test_PloneTool_deleteObjectsByPaths(self):
'paths:list=news')
self.assertFalse(self.portal.get('news', None))

def test_PloneTool_transitionObjectsByPaths(self):
infoFor = self.portal.portal_workflow.getInfoFor
frontpage = self.portal['front-page']
self.assertEqual(infoFor(frontpage, 'review_state'), 'published')
self.checkAuthenticator(
'/plone_utils/transitionObjectsByPaths',
'workflow_action=retract&paths:list=front-page', status=302)
self.assertEqual(infoFor(frontpage, 'review_state'), 'visible')

def test_PloneTool_renameObjectsByPaths(self):
self.assertFalse(self.portal.get('foo', None))
self.checkAuthenticator(
Expand Down
95 changes: 3 additions & 92 deletions Products/CMFPlone/tests/testContentPublishing.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ class TestContentPublishing(PloneTestCase):

This testcase was written to prevent collector/2914 regressions

In addition, some more general tests of content_status_modify and
folder_publish behaviour have been added, since this seems a logical
place to keep them.
In addition, some more general tests of content_status_modify
have been added, since this seems a logical place to keep them.
"""

def afterSetUp(self):
Expand All @@ -54,95 +53,7 @@ def afterSetUp(self):
self.workflow = self.portal.portal_workflow
self.setupAuthenticator()

def _checkMD(self, obj, **changes):
""" check the DublinCore Metadata on obj - it must inherit from
DublinCore """
if changes:
_orig_props = {}
_orig_props.update(props)
props.update(changes)

self.assertEqual(obj.Title(), props['title'])
self.assertEqual(obj.Description(), props['description'])
self.assertEqual(obj.Subject(), tuple(props['subject']))
self.assertEqual(obj.ExpirationDate(zone='UTC'),
obj._datify(props['expiration_date']).ISO())
self.assertEqual(obj.EffectiveDate(zone='UTC'),
obj._datify(props['effective_date']).ISO())
self.assertEqual(obj.Format(), props['format'])
self.assertEqual(obj.Rights(), props['rights'])
self.assertEqual(obj.Language(), props['language'])
self.assertEqual(obj.Contributors(), tuple(props['contributors']))

if changes:
props.update(_orig_props)

# Test the recursive behaviour of content_status_modify and folder_publish:

def testPublishingSubobjects(self):
self.setRoles(['Manager']) # Make sure we can publish directly
self.folder.invokeFactory('Document', id='d1', title='Doc 1')
self.folder.invokeFactory('Folder', id='f1', title='Folder 1')
self.folder.f1.invokeFactory('Document', id='d2', title='Doc 2')
self.folder.f1.invokeFactory('Folder', id='f2', title='Folder 2')
paths = []
for o in (self.folder.d1, self.folder.f1):
paths.append('/'.join(o.getPhysicalPath()))

# folder_publish requires a non-GET request
self.setRequestMethod('POST')
self.folder.folder_publish(workflow_action='publish',
paths=paths,
include_children=True)
for o in (self.folder.d1, self.folder.f1, self.folder.f1.d2,
self.folder.f1.f2):
self.assertEqual(self.workflow.getInfoFor(o, 'review_state'),
'published')

def testPublishingSubobjectsAndExpireThem(self):
self.setRoles(['Manager']) # Make sure we can publish directly
self.folder.invokeFactory('Document', id='d1', title='Doc 1')
self.folder.invokeFactory('Folder', id='f1', title='Folder 1')
self.folder.f1.invokeFactory('Document', id='d2', title='Doc 2')
self.folder.f1.invokeFactory('Folder', id='f2', title='Folder 2')
paths = []
for o in (self.folder.d1, self.folder.f1):
paths.append('/'.join(o.getPhysicalPath()))

# folder_publish requires a non-GET request
self.setRequestMethod('POST')
self.folder.folder_publish(workflow_action='publish',
paths=paths,
effective_date='1/1/2001',
expiration_date='1/2/2001',
include_children=True)
for o in (self.folder.d1, self.folder.f1, self.folder.f1.d2,
self.folder.f1.f2):
self.assertEqual(self.workflow.getInfoFor(o, 'review_state'),
'published')
self.assertTrue(isExpired(o))

def testPublishingWithoutSubobjects(self):
self.setRoles(['Manager']) # Make sure we can publish directly
self.folder.invokeFactory('Document', id='d1', title='Doc 1')
self.folder.invokeFactory('Folder', id='f1', title='Folder 1')
self.folder.f1.invokeFactory('Document', id='d2', title='Doc 2')
self.folder.f1.invokeFactory('Folder', id='f2', title='Folder 2')
paths = []
for o in (self.folder.d1, self.folder.f1):
paths.append('/'.join(o.getPhysicalPath()))

# folder_publish requires a non-GET request
self.setRequestMethod('POST')
self.folder.folder_publish(workflow_action='publish',
paths=paths,
include_children=False)
for o in (self.folder.d1, self.folder.f1):
self.assertEqual(self.workflow.getInfoFor(o, 'review_state'),
'published')
for o in (self.folder.f1.d2, self.folder.f1.f2):
self.assertEqual(self.workflow.getInfoFor(o, 'review_state'),
'visible')
# Test the recursive behaviour of content_status_modify:

def testPublishingNonDefaultPageLeavesFolderAlone(self):
self.setRoles(['Manager']) # Make sure we can publish directly
Expand Down
4 changes: 4 additions & 0 deletions news/3057.breaking
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Removed ``folder_publish.cpy`` script.
Replaced with folder_publish browser view in ``plone.app.content``.
Removed deprecated transitionObjectsByPaths.
[maurits]