Commit d2153773 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Only use getObject if needed.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20637 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 02d029b2
...@@ -1925,7 +1925,7 @@ class ListBoxRendererLine: ...@@ -1925,7 +1925,7 @@ class ListBoxRendererLine:
processed_value = original_value processed_value = original_value
else: else:
# This is an usual line. # This is an usual line.
obj = self.getObject() obj = None # Only evaluate if needed
brain = self.getBrain() brain = self.getBrain()
# Use a widget, if any. # Use a widget, if any.
...@@ -1934,16 +1934,19 @@ class ListBoxRendererLine: ...@@ -1934,16 +1934,19 @@ class ListBoxRendererLine:
if editable_field is not None: if editable_field is not None:
tales = editable_field.tales.get('default', '') tales = editable_field.tales.get('default', '')
if tales: if tales:
if obj is None: obj = self.getObject()
original_value = editable_field.__of__(obj).get_value('default', original_value = editable_field.__of__(obj).get_value('default',
cell=brain) cell=brain)
processed_value = original_value processed_value = original_value
# 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 brain is not obj and getattr(aq_self(brain), alias, None) is not None: if (obj is None or brain is not obj) and getattr(aq_self(brain), alias, None) is not None:
original_value = getattr(brain, alias) original_value = getattr(brain, alias)
processed_value = original_value processed_value = original_value
elif obj is not None: else:
obj = self.getObject()
if obj is not None:
try: try:
# Get the trailing part. # Get the trailing part.
try: try:
......
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