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: ...@@ -334,6 +334,7 @@ class PropertyHolder:
else: else:
accessor.registerTransitionAlways(ptype, wf_id, tr_id) accessor.registerTransitionAlways(ptype, wf_id, tr_id)
setattr(self, id, accessor) setattr(self, id, accessor)
return accessor
def registerAccessor(self, id, key, accessor_class, accessor_args): def registerAccessor(self, id, key, accessor_class, accessor_args):
""" """
...@@ -864,10 +865,8 @@ class Base( CopyContainer, ...@@ -864,10 +865,8 @@ class Base( CopyContainer,
try: try:
property_holder = Base.aq_portal_type[aq_key] property_holder = Base.aq_portal_type[aq_key]
accessor = getattr(property_holder, id, None) accessor = getattr(property_holder, id, None)
if type(accessor) is tuple: if type(accessor) is tuple and id not in RESERVED_TUPLE_PROPERTY:
if id not in RESERVED_TUPLE_PROPERTY: accessor = property_holder.createAccessor(id)
property_holder.createAccessor(id)
accessor = getattr(property_holder, id, None)
return accessor return accessor
except KeyError: except KeyError:
pass 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