From f1913678bba05c970c6645fbb92cbd0e94901f80 Mon Sep 17 00:00:00 2001
From: Sebastien Robin <seb@nexedi.com>
Date: Mon, 15 Sep 2008 09:58:34 +0000
Subject: [PATCH] - do not specify id when creating temp object - make sure
 that the portal type is initialized before searching data   into
 Base._aq_portal_type

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23606 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../ERP5Type/DocumentationHelper/DocumentationHelper.py    | 2 +-
 .../PortalTypeInstanceDocumentationHelper.py               | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/product/ERP5Type/DocumentationHelper/DocumentationHelper.py b/product/ERP5Type/DocumentationHelper/DocumentationHelper.py
index 932b46f7f1..0b0215baca 100644
--- a/product/ERP5Type/DocumentationHelper/DocumentationHelper.py
+++ b/product/ERP5Type/DocumentationHelper/DocumentationHelper.py
@@ -66,7 +66,7 @@ class TempObjectLibrary(object):
         container = self(random.choice(possible_parent_list))
       else:
         container = self.root
-      temp_object = container.newContent(portal_type=portal_type, temp_object=1, id=portal_type)
+      temp_object = container.newContent(portal_type=portal_type, temp_object=1)
       self.portal_type_dict[portal_type] = temp_object
     return temp_object
 
diff --git a/product/ERP5Type/DocumentationHelper/PortalTypeInstanceDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/PortalTypeInstanceDocumentationHelper.py
index d8e0b29b6d..bdc570242e 100644
--- a/product/ERP5Type/DocumentationHelper/PortalTypeInstanceDocumentationHelper.py
+++ b/product/ERP5Type/DocumentationHelper/PortalTypeInstanceDocumentationHelper.py
@@ -98,7 +98,12 @@ class PortalTypeInstanceDocumentationHelper(DocumentationHelper):
 
   def _getPropertyHolder(self):
     from Products.ERP5Type.Base import Base
-    return Base.aq_portal_type[(self.getPortalType(), self.getInstance().__class__)]
+    property_holder = None
+    key = (self.getPortalType(), self.getInstance().__class__)
+    if not(Base.aq_portal_type.has_key(key)):
+      self.getInstance().initializePortalTypeDynamicProperties()
+    property_holder =  Base.aq_portal_type[(self.getPortalType(), self.getInstance().__class__)]
+    return property_holder
 
   security.declareProtected( Permissions.AccessContentsInformation, 'getAccessorMethodItemList' )
   def getAccessorMethodItemList(self):
-- 
2.30.9