Commit ab223cf8 authored by Nicolas Dumazet's avatar Nicolas Dumazet

getattr() only once


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42496 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d4a3d201
......@@ -671,13 +671,13 @@ def initializePortalTypeDynamicWorkflowMethods(self, klass, ptype, prop_holder,
transition_id_set, trigger_dict = v
for tr_id, tdef in trigger_dict.iteritems():
method_id = convertToMixedCase(tr_id)
if getattr(klass, method_id, _MARKER) is _MARKER:
method = getattr(klass, method_id, _MARKER)
if method is _MARKER:
prop_holder.security.declareProtected(Permissions.AccessContentsInformation,
method_id)
prop_holder.registerWorkflowMethod(method_id, wf_id, tr_id)
continue
method = getattr(klass, method_id)
# Wrap method
if not callable(method):
LOG('initializePortalTypeDynamicWorkflowMethods', 100,
......@@ -725,7 +725,8 @@ def initializePortalTypeDynamicWorkflowMethods(self, klass, ptype, prop_holder,
# It's not consistent with regexp based filters.
method_id_list = [imethod_id]
for method_id in method_id_list:
if getattr(klass, method_id, _MARKER) is _MARKER:
method = getattr(klass, method_id, _MARKER)
if method is _MARKER:
# set a default security, if this method is not already
# protected.
if method_id not in prop_holder.security.names:
......@@ -735,7 +736,6 @@ def initializePortalTypeDynamicWorkflowMethods(self, klass, ptype, prop_holder,
tdef.once_per_transaction)
continue
method = getattr(klass, method_id)
# Wrap method
if not callable(method):
LOG('initializePortalTypeDynamicWorkflowMethods', 100,
......
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