Commit d040ec61 authored by Jérome Perrin's avatar Jérome Perrin

Listbox: fix the way to get a property on document

The use of getProperty with a default value was wrong because it does not
display anything if the property is not set and fallbacks to acquisition.
parent c72b3014
...@@ -36,6 +36,7 @@ from Products.Formulator.Errors import FormValidationError, ValidationError ...@@ -36,6 +36,7 @@ from Products.Formulator.Errors import FormValidationError, ValidationError
from Selection import Selection, DomainSelection from Selection import Selection, DomainSelection
from Tool.SelectionTool import createFolderMixInPageSelectionMethod from Tool.SelectionTool import createFolderMixInPageSelectionMethod
from Products.ERP5Type.Utils import getPath from Products.ERP5Type.Utils import getPath
from Products.ERP5Type.Utils import UpperCase
from Products.ERP5Type.Document import newTempBase from Products.ERP5Type.Document import newTempBase
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.ZSQLCatalog.zsqlbrain import ZSQLBrain from Products.ZSQLCatalog.zsqlbrain import ZSQLBrain
...@@ -2285,10 +2286,11 @@ class ListBoxRendererLine: ...@@ -2285,10 +2286,11 @@ class ListBoxRendererLine:
property_id = sql property_id = sql
try: try:
original_value = obj.getProperty(property_id, _marker) accessor_name = 'get%s' % UpperCase(property_id)
if original_value is _marker: # Make sure the object have the attribute, and this is not
raise AttributeError, property_id # acquired, but still get the attribute on the acquisition wrapper
processed_value = original_value getattr(aq_base(obj), accessor_name)
processed_value = original_value = getattr(obj, accessor_name)
except AttributeError: except AttributeError:
original_value = getattr(obj, property_id, None) original_value = getattr(obj, property_id, None)
processed_value = original_value processed_value = original_value
......
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