From 96c7b23d7f7bbb275be20efbc0b9d4c61139a33e Mon Sep 17 00:00:00 2001
From: Arnaud Fontaine <arnaud.fontaine@nexedi.com>
Date: Wed, 9 Feb 2011 06:22:55 +0000
Subject: [PATCH] When adding a new category in a ZODB Property Sheet, the
 reference has not been filled yet, thus re-generated accessors could have
 failed

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43206 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/Tool/PropertySheetTool.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/product/ERP5Type/Tool/PropertySheetTool.py b/product/ERP5Type/Tool/PropertySheetTool.py
index f99445bd4b7..fe25a724800 100644
--- a/product/ERP5Type/Tool/PropertySheetTool.py
+++ b/product/ERP5Type/Tool/PropertySheetTool.py
@@ -221,9 +221,19 @@ class PropertySheetTool(BaseTool):
     categories = []
 
     for property in property_sheet.contentValues():
-      portal_type = property.getPortalType()
       property_definition = property.exportToFilesystemDefinition()
 
+      # If a category doesn't have a name yet or the constraint class
+      # returned is None, then just skip it
+      if property_definition is None:
+        LOG("Tool.PropertySheetTool", INFO,
+            "Skipping property with ID '%s' in Property Sheet '%s'" % \
+            (property.getId(), property_sheet.getId()))
+
+        continue
+
+      portal_type = property.getPortalType()
+
       if portal_type == "Category Property" or \
          portal_type == "Dynamic Category Property":
         categories.append(property_definition)
-- 
2.30.9