From 898caf119674d4d7a7064e622366ab6926085068 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Sat, 4 Mar 2006 14:11:47 +0000
Subject: [PATCH] Do not assume the path always exists in the domain tree (eg.
 the category has been deleted in the meanwhile)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5980 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Form/ListBox.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/product/ERP5Form/ListBox.py b/product/ERP5Form/ListBox.py
index d8c1014634..4afd6a84e5 100755
--- a/product/ERP5Form/ListBox.py
+++ b/product/ERP5Form/ListBox.py
@@ -882,11 +882,13 @@ class ListBoxWidget(Widget.Widget):
               base_category = domain.split('/')[0]
               if portal_categories is not None:
                 if base_category in portal_categories.objectIds():
-                  root = root_dict[base_category] = portal_categories.restrictedTraverse(domain)
+                  root = portal_categories.restrictedTraverse(domain, None)
+                  if root is not None :
+                    root_dict[base_category] = root
               if root is None and portal_domains is not None:
                 if base_category in portal_domains.objectIds():
                   base_domain = portal_domains.getDomainByPath(domain)
-                  root =  base_domain
+                  root = base_domain
                   root_dict[base_category] = base_domain.getRelativeUrl()
               if root is None:
                 try:
-- 
2.30.9