Skip to content

Commit

Permalink
Make it possible to delete broken portlet assignment.
Browse files Browse the repository at this point in the history
  • Loading branch information
vipod committed Feb 23, 2013
1 parent 24037f8 commit f69fb3f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Changelog
2.4.2 (unreleased)
------------------

- Make it possible to delete broken portlet assignment.
[vipod]

- Make sure a portlet name is not a unicode string. This prevents problems when
trying to use a portlet name in joined strings.
[wichert]
Expand Down
11 changes: 11 additions & 0 deletions plone/app/portlets/browser/editmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from plone.portlets.utils import hashPortletInfo
from plone.portlets.utils import unhashPortletInfo

from zope.container import contained
from zope.interface import implements, Interface
from zope.component import adapts, getMultiAdapter, queryMultiAdapter, queryAdapter, getUtility
from zope.contentprovider.interfaces import UpdateNotCalled
Expand Down Expand Up @@ -403,7 +404,17 @@ def delete_portlet(self, name):
self.authorize()
assignments = aq_inner(self.context)
IPortletPermissionChecker(assignments)()

# set fixing_up to True to let zope.container.contained
# know that our object doesn't have __name__ and __parent__
fixing_up = contained.fixing_up
contained.fixing_up = True

del assignments[name]

# revert our fixing_up customization
contained.fixing_up = fixing_up

return self.finish_portlet_change()

def _nextUrl(self):
Expand Down

3 comments on commit f69fb3f

@mister-roboto
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing:

@mister-roboto
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing:

@davilima6
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.