Skip to content

Commit

Permalink
Merge pull request #3366 from plone/cleanup-Portal
Browse files Browse the repository at this point in the history
Cleanup Portal
  • Loading branch information
jensens authored Nov 25, 2021
2 parents 9b13421 + 5bda0c1 commit 2d95fbf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
20 changes: 2 additions & 18 deletions Products/CMFPlone/Portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from five.localsitemanager.registry import PersistentComponents
from OFS.ObjectManager import REPLACEABLE
from plone.dexterity.content import Container
from plone.i18n.locales.interfaces import IMetadataLanguageAvailability
from Products.CMFCore import permissions
from Products.CMFCore.interfaces import IContentish
from Products.CMFCore.interfaces import ISiteRoot
Expand Down Expand Up @@ -34,7 +33,6 @@
from Products.CMFPlone.permissions import ReplyToItem
from Products.CMFPlone.permissions import View
from Products.Five.component.interfaces import IObjectManagerSite
from zope.component import queryUtility
from zope.interface.interfaces import ComponentLookupError
from zope.event import notify
from zope.interface import classImplementsOnly
Expand Down Expand Up @@ -174,8 +172,7 @@ def manage_beforeDelete(self, container, item):
PloneSite.inheritedAttribute('manage_beforeDelete')(self, container,
item)

security.declareProtected(permissions.DeleteObjects, 'manage_delObjects')

@security.protected(permissions.DeleteObjects)
def manage_delObjects(self, ids=None, REQUEST=None):
"""We need to enforce security."""
if ids is None:
Expand All @@ -195,9 +192,7 @@ def view(self):
"""
return self()

security.declareProtected(permissions.AccessContentsInformation,
'folderlistingFolderContents')

@security.protected(permissions.AccessContentsInformation)
def folderlistingFolderContents(self, contentFilter=None):
"""Calls listFolderContents in protected only by ACI so that
folder_listing can work without the List folder contents permission.
Expand All @@ -207,17 +202,6 @@ def folderlistingFolderContents(self, contentFilter=None):
"""
return self.listFolderContents(contentFilter)

security.declarePublic('availableLanguages')

def availableLanguages(self):
util = queryUtility(IMetadataLanguageAvailability)
languages = util.getLanguageListing()
languages.sort(lambda x, y: cmp(x[1], y[1]))
# Put language neutral at the top.
languages.insert(0, ('', _('Language neutral (site default)')))

return languages

def isEffective(self, date):
# Override DefaultDublinCoreImpl's test, since we are always viewable.
return 1
Expand Down
3 changes: 3 additions & 0 deletions news/3337.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fixes #3337:
Remove dead code that wont work in Py 3 anyway if called (cmp).
[jensens]
2 changes: 2 additions & 0 deletions news/3366.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
In Portal: use security decorators
[jensens]

0 comments on commit 2d95fbf

Please sign in to comment.