From da7ce1b5ecdcd22fcd96f6863ceb709bfef0d117 Mon Sep 17 00:00:00 2001
From: Mayoro Diagne <mayoro@nexedi.com>
Date: Sat, 5 Jul 2008 19:26:14 +0000
Subject: [PATCH] using id for temp_object of documentation instead of 'None'

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22290 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../DocumentationHelper.py                    | 14 +++++---
 .../WorkflowMethodDocumentationHelper.py      | 33 +------------------
 2 files changed, 10 insertions(+), 37 deletions(-)

diff --git a/product/ERP5Type/DocumentationHelper/DocumentationHelper.py b/product/ERP5Type/DocumentationHelper/DocumentationHelper.py
index 58c7abc000..1be5878fe9 100644
--- a/product/ERP5Type/DocumentationHelper/DocumentationHelper.py
+++ b/product/ERP5Type/DocumentationHelper/DocumentationHelper.py
@@ -46,7 +46,8 @@ class TempObjectLibrary(object):
   def __init__(self, container):
     # Folder objects doesn't filter content types.
     # Objects are created in a folder when there is no other choice.
-    self.root = container.newContent(portal_type='Folder', temp_object=1)
+    self.root = container.newContent(portal_type='Folder', temp_object=1, id='temp_instance')
+    #self.root = container.newContent(portal_type='Folder', temp_object=1)
     self.portal_type_dict = {}
     self.dependency_dict = {}
     for type_info in container._getTypesTool().listTypeInfo():
@@ -65,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)
+      temp_object = container.newContent(portal_type=portal_type, temp_object=1, id=portal_type)
       self.portal_type_dict[portal_type] = temp_object
     return temp_object
 
@@ -103,7 +104,6 @@ class DocumentationHelper(Implicit):
     if self.uri.startswith('portal_classes/temp_instance'):
       url, method = self.uri.split('#')
       portal_type = url.split('/')[-1]
-      self.getTempInstance = TempObjectLibrary(self.getPortalObject().portal_classes)
       temp_object = self.getTempInstance(portal_type)
       if '/' not in method:
         documented_object = getattr(temp_object, method, None)
@@ -147,8 +147,12 @@ class DocumentationHelper(Implicit):
         url, method = self.uri.split('#')
         documented_object = self.getPortalObject().unrestrictedTraverse(url, None)
         if '/' not in method:
-          documented_object = self.getPortalObject().unrestrictedTraverse(url, None)
-          documented_object = getattr(documented_object, method, None)
+	  if documented_object is not None:	
+            if documented_object.getId() in self.getPortalObject().portal_types.objectIds():
+              temp_object = self.getTempInstance(documented_object.getId())
+              documented_object = getattr(temp_object, method, None)
+            else:
+              documented_object = getattr(documented_object, method, None)
         else:
           path_method = method.split('/')
           wf_method = path_method[len(path_method)-1]
diff --git a/product/ERP5Type/DocumentationHelper/WorkflowMethodDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/WorkflowMethodDocumentationHelper.py
index 410dd2d4d7..5ee3f3b37b 100644
--- a/product/ERP5Type/DocumentationHelper/WorkflowMethodDocumentationHelper.py
+++ b/product/ERP5Type/DocumentationHelper/WorkflowMethodDocumentationHelper.py
@@ -59,7 +59,7 @@ class WorkflowMethodDocumentationHelper(DocumentationHelper):
     """
     Returns the title of the documentation helper
     """
-    return getattr(self.getDocumentedObject(), "__name__", '')
+    return getattr(self.getDocumentedObject(), "_transition_id", '')
 
   security.declareProtected( Permissions.AccessContentsInformation, 'getSectionList' )
   def getSectionList(self):
@@ -68,37 +68,6 @@ class WorkflowMethodDocumentationHelper(DocumentationHelper):
     """
     return []
 
-
-  #security.declareProtected(Permissions.AccessContentsInformation, 'getDestinationState' )
-  #def getDestinationState(self):
-  #  """
-  #  Returns the destination_state of the transition workflow method
-  #  """
-  #  return self.getDocumentedObject().__dict__['new_state_id']
-
-  #security.declareProtected(Permissions.AccessContentsInformation, 'getTriggerType' )
-  #def getTriggerType(self):
-  #  """
-  #  Returns the trigger type of the workflow method
-  #  """
-  #  TT = ['Automatic','Initiated by user action','Initiated by WorkflowMethod']
-  #  TT_id = self.getDocumentedObject().__dict__['trigger_type']
-  #  return TT[TT_id]
-
-  #security.declareProtected(Permissions.AccessContentsInformation, 'getLocalRoles' )
-  #def getLocalRoles(self):
-  #  """
-  #  Returns the local roles of the workflow method
-  #  """
-  #  return self.getDocumentedObject().__ac_local_roles__
-
-  #security.declareProtected(Permissions.AccessContentsInformation, 'getAvailableStateIds' )
-  #def getAvailableStateIds(self):
-  #  """
-  #  Returns available states in the workflow
-  #  """
-  #  return self.getDocumentedObject().getAvailableStateIds()
-
   security.declareProtected( Permissions.AccessContentsInformation, 'getDefinition' )
   def getDefinition(self):
     """
-- 
2.30.9