Commit 7f87baae authored by Vincent Pelletier's avatar Vincent Pelletier

Minor performance improvements:

  Make createAccessor return generated accessor to save one getattr in _aq_dynamic.
  Merge 2 tests in a single "if".


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21100 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b728b5bf
......@@ -334,6 +334,7 @@ class PropertyHolder:
else:
accessor.registerTransitionAlways(ptype, wf_id, tr_id)
setattr(self, id, accessor)
return accessor
def registerAccessor(self, id, key, accessor_class, accessor_args):
"""
......@@ -864,10 +865,8 @@ class Base( CopyContainer,
try:
property_holder = Base.aq_portal_type[aq_key]
accessor = getattr(property_holder, id, None)
if type(accessor) is tuple:
if id not in RESERVED_TUPLE_PROPERTY:
property_holder.createAccessor(id)
accessor = getattr(property_holder, id, None)
if type(accessor) is tuple and id not in RESERVED_TUPLE_PROPERTY:
accessor = property_holder.createAccessor(id)
return accessor
except KeyError:
pass
......
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