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, ...@@ -671,13 +671,13 @@ def initializePortalTypeDynamicWorkflowMethods(self, klass, ptype, prop_holder,
transition_id_set, trigger_dict = v transition_id_set, trigger_dict = v
for tr_id, tdef in trigger_dict.iteritems(): for tr_id, tdef in trigger_dict.iteritems():
method_id = convertToMixedCase(tr_id) 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, prop_holder.security.declareProtected(Permissions.AccessContentsInformation,
method_id) method_id)
prop_holder.registerWorkflowMethod(method_id, wf_id, tr_id) prop_holder.registerWorkflowMethod(method_id, wf_id, tr_id)
continue continue
method = getattr(klass, method_id)
# Wrap method # Wrap method
if not callable(method): if not callable(method):
LOG('initializePortalTypeDynamicWorkflowMethods', 100, LOG('initializePortalTypeDynamicWorkflowMethods', 100,
...@@ -725,7 +725,8 @@ def initializePortalTypeDynamicWorkflowMethods(self, klass, ptype, prop_holder, ...@@ -725,7 +725,8 @@ def initializePortalTypeDynamicWorkflowMethods(self, klass, ptype, prop_holder,
# It's not consistent with regexp based filters. # It's not consistent with regexp based filters.
method_id_list = [imethod_id] method_id_list = [imethod_id]
for method_id in method_id_list: 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 # set a default security, if this method is not already
# protected. # protected.
if method_id not in prop_holder.security.names: if method_id not in prop_holder.security.names:
...@@ -735,7 +736,6 @@ def initializePortalTypeDynamicWorkflowMethods(self, klass, ptype, prop_holder, ...@@ -735,7 +736,6 @@ def initializePortalTypeDynamicWorkflowMethods(self, klass, ptype, prop_holder,
tdef.once_per_transaction) tdef.once_per_transaction)
continue continue
method = getattr(klass, method_id)
# Wrap method # Wrap method
if not callable(method): if not callable(method):
LOG('initializePortalTypeDynamicWorkflowMethods', 100, 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