Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
5803f7b6
Commit
5803f7b6
authored
Aug 28, 2023
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ListBox: simplify code
parent
9053cc93
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
20 deletions
+15
-20
product/ERP5Form/ListBox.py
product/ERP5Form/ListBox.py
+15
-20
No files found.
product/ERP5Form/ListBox.py
View file @
5803f7b6
...
@@ -31,7 +31,7 @@ from six.moves import xrange
...
@@ -31,7 +31,7 @@ from six.moves import xrange
from
six
import
string_types
as
basestring
from
six
import
string_types
as
basestring
import
sys
import
sys
from
OFS.Traversable
import
NotFound
from
OFS.Traversable
import
NotFound
from
AccessControl
import
ClassSecurityInfo
,
Unauthorized
from
AccessControl
import
ClassSecurityInfo
from
Products.Formulator.DummyField
import
fields
from
Products.Formulator.DummyField
import
fields
from
Products.Formulator
import
Widget
,
Validator
from
Products.Formulator
import
Widget
,
Validator
from
Products.Formulator.Field
import
ZMIField
from
Products.Formulator.Field
import
ZMIField
...
@@ -2338,27 +2338,22 @@ class ListBoxRendererLine:
...
@@ -2338,27 +2338,22 @@ class ListBoxRendererLine:
if
not
tales
:
if
not
tales
:
if
getattr
(
aq_self
(
brain
),
alias
,
None
)
is
not
None
:
if
getattr
(
aq_self
(
brain
),
alias
,
None
)
is
not
None
:
original_value
=
getattr
(
brain
,
alias
)
original_value
=
getattr
(
brain
,
alias
)
processed_value
=
original_value
else
:
else
:
try
:
# Get the trailing part.
# Get the trailing part.
try
:
try
:
property_id
=
sql
[
sql
.
rindex
(
'.'
)
+
1
:]
property_id
=
sql
[
sql
.
rindex
(
'.'
)
+
1
:]
except
ValueError
:
except
ValueError
:
property_id
=
sql
property_id
=
sql
accessor_name
=
'get'
+
UpperCase
(
property_id
)
try
:
try
:
accessor_name
=
'get%s'
%
UpperCase
(
property_id
)
# Make sure the object have the attribute, and this is not
# Make sure the object have the attribute, and this is not
# acquired, but still get the attribute on the acquisition wrapper
# acquired, but still get the attribute on the acquisition wrapper
getattr
(
aq_base
(
obj
),
accessor_name
)
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
)
else
:
original_value
=
getattr
(
obj
,
accessor_name
)
processed_value
=
original_value
processed_value
=
original_value
except
(
AttributeError
,
KeyError
,
Unauthorized
):
original_value
=
None
processed_value
=
'Could not evaluate %s'
%
property_id
# If the value is callable, evaluate it.
# If the value is callable, evaluate it.
if
callable
(
original_value
):
if
callable
(
original_value
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment