marclava
(Marc Lavallée)
November 3, 2020, 7:59pm
1
I would like to disable a decorator used in collective.easyform.browser.actions,
specifically the @button.buttonAndHandler decorator of the handleClearAll method,
so the "Clear All" button does not appear in the "Saved Data" form.
Is there a simple way to disable the decorator without forking collective.easyform?
Something I could declare in my policy package?
jaroel
(Roel Bruggink)
November 3, 2020, 8:25pm
2
Did you try hiding with css?
/macyet
jensens
(Jens W. Klein)
November 3, 2020, 10:17pm
3
Given the "magic" cough done here
return createHandler
def buttonAndHandler(title, **kwargs):
# Add the title to button constructor keyword arguments
kwargs['title'] = title
# Extract directly provided interfaces:
provides = kwargs.pop('provides', ())
# Create button and add it to the button manager
button = Button(**kwargs)
zope.interface.alsoProvides(button, provides)
frame = sys._getframe(1)
f_locals = frame.f_locals
buttons = f_locals.setdefault('buttons', Buttons())
f_locals['buttons'] += Buttons(button)
# Return the handler decorator
return handler(button)
@zope.interface.implementer(interfaces.IButtonAction)
class ButtonAction(action.Action, submit.SubmitWidget, zope.location.Location):
I doubt it is easy, but probably possible.
Kids, dont do this at home, Stephan was young, in need of money, and the code is 14yo.
1 Like
marclava
(Marc Lavallée)
November 4, 2020, 5:04pm
4
That should good enough, thanks.