Commit b46a27a4 authored by Aurel's avatar Aurel

do not use getattr with aq_base, thus we keep acquisition on context

when getting object, rather test before if object without acquisition hold the
attribute


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11595 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ee6274ad
...@@ -649,8 +649,14 @@ class Base( CopyContainer, ...@@ -649,8 +649,14 @@ class Base( CopyContainer,
if storage_id is None: storage_id=key if storage_id is None: storage_id=key
#LOG("Get Acquired Property storage_id",0,str(storage_id)) #LOG("Get Acquired Property storage_id",0,str(storage_id))
# Test presence of attribute without acquisition
# if present, get it in its context, thus we keep acquisition if
# returned value is an object
if hasattr(aq_base(self), storage_id):
value = getattr(self, storage_id, None)
else:
value = None
# If we hold an attribute and mask_value is set, return the attribute # If we hold an attribute and mask_value is set, return the attribute
value = getattr(aq_base(self), storage_id, None)
if mask_value and value is not None: if mask_value and value is not None:
# Pop context # Pop context
del TRANSACTION._erp5_acquisition_stack[acquisition_key] del TRANSACTION._erp5_acquisition_stack[acquisition_key]
......
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