Skip to content

Commit

Permalink
When modal property does not yet exist, create it.
Browse files Browse the repository at this point in the history
  • Loading branch information
mauritsvanrees committed Feb 3, 2023
1 parent cd095ab commit 9d4c402
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Products/CMFPlone/controlpanel/browser/actions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from plone.autoform.form import AutoExtensibleForm
from plone.base.interfaces import IActionSchema
from plone.base.interfaces import INewActionSchema
from plone.base.utils import base_hasattr
from Products.CMFCore.ActionInformation import Action
from Products.CMFCore.interfaces import IAction
from Products.CMFCore.interfaces import IActionCategory
Expand Down Expand Up @@ -169,7 +170,15 @@ def get_modal(self):
return self.context.modal

def set_modal(self, value):
self.context.modal = value
# This property may not exist yet on the context.
if not self.context.hasProperty("modal"):
if base_hasattr(self.context, "modal"):
# We cannot define a property when an attribute with the same
# name already exists.
delattr(self.context, "modal")
self.context._setProperty('modal', value, 'string')
else:
self.context._setPropValue('modal', value)

modal = property(get_modal, set_modal)

Expand Down

0 comments on commit 9d4c402

Please sign in to comment.