Commit 29457833 authored by Tomáš Peterka's avatar Tomáš Peterka Committed by Tomáš Peterka

[Formulator] Method name from Method Field is publically available

parent dd928bbe
......@@ -4,7 +4,7 @@ import Widget, Validator
from Persistence import Persistent
import Acquisition
from Field import ZMIField
from AccessControl import getSecurityManager
from AccessControl import getSecurityManager, ClassSecurityInfo
class MethodWidget(Widget.TextWidget):
default = fields.MethodField('default',
......@@ -27,9 +27,15 @@ MethodWidgetInstance = MethodWidget()
class Method(Persistent, Acquisition.Implicit):
"""A method object; calls method name in acquisition context.
"""
security = ClassSecurityInfo()
def __init__(self, method_name):
self.method_name = method_name
security.declarePublic('getMethodName')
def getMethodName(self):
return self.method_name
def __call__(self, *arg, **kw):
# get method from acquisition path
method = getattr(self, self.method_name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment