From af519422e298f26d3b06fe985807b9a72b9bb6e0 Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Fri, 20 May 2011 13:23:37 +0000
Subject: [PATCH] obj will not be None here.

It's tested earlier in the same method.
---
 product/ERP5Form/ListBox.py | 34 +++++++++++++++-------------------
 1 file changed, 15 insertions(+), 19 deletions(-)

diff --git a/product/ERP5Form/ListBox.py b/product/ERP5Form/ListBox.py
index 304acdc16a..5f507ddca8 100644
--- a/product/ERP5Form/ListBox.py
+++ b/product/ERP5Form/ListBox.py
@@ -2275,28 +2275,24 @@ class ListBoxRendererLine:
             original_value = getattr(brain, alias)
             processed_value = original_value
           else:
-            if obj is not None:
+            try:
+              # Get the trailing part.
               try:
-                # Get the trailing part.
-                try:
-                  property_id = sql[sql.rindex('.') + 1:]
-                except ValueError:
-                  property_id = sql
+                property_id = sql[sql.rindex('.') + 1:]
+              except ValueError:
+                property_id = sql
 
-                try:
-                  original_value = obj.getProperty(property_id, _marker)
-                  if original_value is _marker:
-                    raise AttributeError, property_id
-                  processed_value = original_value
-                except AttributeError:
-                  original_value = getattr(obj, property_id, None)
-                  processed_value = original_value
-              except (AttributeError, KeyError, Unauthorized):
-                original_value = None
-                processed_value = 'Could not evaluate %s' % property_id
-            else:
+              try:
+                original_value = obj.getProperty(property_id, _marker)
+                if original_value is _marker:
+                  raise AttributeError, property_id
+                processed_value = original_value
+              except AttributeError:
+                original_value = getattr(obj, property_id, None)
+                processed_value = original_value
+            except (AttributeError, KeyError, Unauthorized):
               original_value = None
-              processed_value = 'Object does not exist'
+              processed_value = 'Could not evaluate %s' % property_id
 
       # If the value is callable, evaluate it.
       if callable(original_value):
-- 
2.30.9