Commit 8e3d2599 authored by Julien Muchembled's avatar Julien Muchembled

ListBox: fix possible unexpected acquisition

The use case is a listbox method being called for a document A
and returning objects that:
- aren't children of A
- but wrapped with `.__of__(A)`

By using `aq_self` instead of `aq_base`, the listbox could still
acquire from the real parent of the returned object and wrongly access
an attribute directly (e.g. comment) instead of using an appropriate
method (if there's no `comment` attribute, getComment returns '').

See merge request nexedi/erp5!1820
parent 5803f7b6
...@@ -2336,7 +2336,7 @@ class ListBoxRendererLine: ...@@ -2336,7 +2336,7 @@ class ListBoxRendererLine:
# If a tales expression is not defined, get a skin, an accessor or a property. # If a tales expression is not defined, get a skin, an accessor or a property.
if not tales: if not tales:
if getattr(aq_self(brain), alias, None) is not None: if getattr(aq_base(brain), alias, brain) is not brain:
original_value = getattr(brain, alias) original_value = getattr(brain, alias)
else: else:
# Get the trailing part. # Get the trailing part.
......
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