From 0445bd52754ee848fd412b96850ee5c174b2019f Mon Sep 17 00:00:00 2001
From: Mayoro Diagne <mayoro@nexedi.com>
Date: Thu, 4 Sep 2008 15:46:45 +0000
Subject: [PATCH] testing documented object before calling Description()

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23424 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../DocumentationHelper/CatalogMethodDocumentationHelper.py | 4 ++--
 .../PortalTypeRoleDocumentationHelper.py                    | 6 +++++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/product/ERP5Type/DocumentationHelper/CatalogMethodDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/CatalogMethodDocumentationHelper.py
index 82fa4cd879..506088dd5d 100644
--- a/product/ERP5Type/DocumentationHelper/CatalogMethodDocumentationHelper.py
+++ b/product/ERP5Type/DocumentationHelper/CatalogMethodDocumentationHelper.py
@@ -66,10 +66,10 @@ class CatalogMethodDocumentationHelper(DocumentationHelper):
   security.declareProtected(Permissions.AccessContentsInformation, 'getSource' )
   def getSource(self):
     """
-    Returns the source code of the documentation helper
+    Returns the source code the catalog method
     """
     from zLOG import LOG, INFO
-    source_code =  getattr(self.getDocumentedObject(), 'src', '')
+    source_code = getattr(self.getDocumentedObject(), 'src', '')
     portal_transforms = getattr(self, 'portal_transforms', None)
     if portal_transforms is not None:
       REQUEST = getattr(self, 'REQUEST', None)
diff --git a/product/ERP5Type/DocumentationHelper/PortalTypeRoleDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/PortalTypeRoleDocumentationHelper.py
index 3de0c52ab6..c6afc1fb5c 100644
--- a/product/ERP5Type/DocumentationHelper/PortalTypeRoleDocumentationHelper.py
+++ b/product/ERP5Type/DocumentationHelper/PortalTypeRoleDocumentationHelper.py
@@ -44,7 +44,11 @@ class PortalTypeRoleDocumentationHelper(DocumentationHelper):
 
   security.declareProtected(Permissions.AccessContentsInformation, 'getDescription')
   def getDescription(self):
-    return self.getDocumentedObject().Description()
+    documented_object = self.getDocumentedObject()
+    if documented_object is not None:
+      return documented_object.Description()
+    else:
+      return ''
 
   security.declareProtected(Permissions.AccessContentsInformation, 'getType' )
   def getType(self):
-- 
2.30.9