diff --git a/product/ERP5Type/DocumentationHelper/AccessorMethodDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/AccessorMethodDocumentationHelper.py index 59dd7e20f215ba010ee916ae0d3a691db3da9291..0e1f8325742b620e8683bacae86c06993f5ff9b2 100644 --- a/product/ERP5Type/DocumentationHelper/AccessorMethodDocumentationHelper.py +++ b/product/ERP5Type/DocumentationHelper/AccessorMethodDocumentationHelper.py @@ -78,7 +78,7 @@ class AccessorMethodDocumentationHelper(DocumentationHelper): security.declareProtected(Permissions.AccessContentsInformation, 'getDescription') def getDescription(self): - return self.getDocumentedObject().__doc__ + return getattr(self.getDocumentedObject(), "__doc__", "") security.declareProtected( Permissions.AccessContentsInformation, 'getType' ) def getType(self): @@ -86,14 +86,13 @@ class AccessorMethodDocumentationHelper(DocumentationHelper): Returns the type of the documentation helper """ return "Accessor Method" - #return self.getDocumentedObject().func_code.__module__ security.declareProtected( Permissions.AccessContentsInformation, 'getTitle' ) def getTitle(self): """ Returns the title of the documentation helper """ - return self.getDocumentedObject().__name__ + return getattr(self.getDocumentedObject(), "__name__", "") security.declareProtected(Permissions.AccessContentsInformation, 'getSectionList') def getSectionList(self): diff --git a/product/ERP5Type/DocumentationHelper/BusinessTemplateDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/BusinessTemplateDocumentationHelper.py index b61fd3b72da49bee3741c2db53c22068d72c5291..f5f425e2ab92cba319bfd01c5a7afdaf7dd2ed5f 100644 --- a/product/ERP5Type/DocumentationHelper/BusinessTemplateDocumentationHelper.py +++ b/product/ERP5Type/DocumentationHelper/BusinessTemplateDocumentationHelper.py @@ -49,7 +49,7 @@ class BusinessTemplateDocumentationHelper(DocumentationHelper): """ Returns the title of the documentation helper """ - return self.getDocumentedObject().title + return getattr(self.getDocumentedObject(), 'title', '') security.declareProtected( Permissions.AccessContentsInformation, 'getType' ) def getType(self): @@ -114,21 +114,21 @@ class BusinessTemplateDocumentationHelper(DocumentationHelper): """ Returns the description of the documentation helper """ - return self.getDocumentedObject().description + return getattr(self.getDocumentedObject(), 'description', '') security.declareProtected( Permissions.AccessContentsInformation, 'getVersion' ) def getVersion(self): """ Returns the version of the business template """ - return self.getDocumentedObject().version + return getattr(self.getDocumentedObject(), 'version', '') security.declareProtected( Permissions.AccessContentsInformation, 'getRevisionNumber' ) def getRevisionNumber(self): """ Returns the revision number of the documentation helper """ - return self.getDocumentedObject().revision + return getattr(self.getDocumentedObject(), 'revision', '') security.declareProtected( Permissions.AccessContentsInformation, 'getBuildingState' ) def getBuildingState(self): @@ -149,14 +149,15 @@ class BusinessTemplateDocumentationHelper(DocumentationHelper): """ Returns the list of maintainers of the business template """ - return self.getDocumentedObject().maintainer + return getattr(self.getDocumentedObject(), 'maintainer', '') security.declareProtected( Permissions.AccessContentsInformation, 'getDependencyList' ) def getDependencyList(self): """ Returns the list of dependencies of the business template """ - return self.getDocumentedObject().dependency + return getattr(self.getDocumentedObject(), 'dependency', '') + security.declareProtected( Permissions.AccessContentsInformation, 'getPortalTypeIdList' ) def getPortalTypeIdList(self): @@ -191,8 +192,8 @@ class BusinessTemplateDocumentationHelper(DocumentationHelper): """ """ dc_workflow_list = [] - #for wf in self.getDocumentedObject().template_workflow_id: - for wf in getattr(self.getDocumentedObject(), 'template_workflow_id', []): + template_workflow_id_list = getattr(self.getDocumentedObject(), 'template_workflow_id', []) + for wf in template_workflow_id_list: url = '/' + self.getPortalObject().id + '/portal_workflow/' + wf wf_object = self.getPortalObject().unrestrictedTraverse(url) if wf_object.__class__.__name__ == 'DCWorkflowDefinition': @@ -212,7 +213,8 @@ class BusinessTemplateDocumentationHelper(DocumentationHelper): """ """ workflow_list = [] - for wf in getattr(self.getDocumentedObject(), 'template_workflow_id', []): + template_workflow_id_list = getattr(self.getDocumentedObject(), 'template_workflow_id', []) + for wf in template_workflow_id_list: url = '/' + self.getPortalObject().id + '/portal_workflow/' + wf wf_object = self.getPortalObject().unrestrictedTraverse(url) if wf_object.__class__.__name__ == 'InteractionWorkflowDefinition': @@ -231,9 +233,9 @@ class BusinessTemplateDocumentationHelper(DocumentationHelper): def getBaseCategoryList(self): """ """ - return getattr(self.getDocumentedObject(), 'template_base_category', []) + return getattr(self.getDocumentedObject(), 'template_base_category', '') - security.declareProtected( Permissions.AccessContentsInformation, 'getPortalTypeURIList' ) + security.declareProtected( Permissions.AccessContentsInformation, 'getBaseCategoryURIList' ) def getBaseCategoryURIList(self): """ """ diff --git a/product/ERP5Type/DocumentationHelper/CatalogMethodDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/CatalogMethodDocumentationHelper.py index d3e286e6058f0198ba632dce5dc226c317c5b339..7ff9875b66007ff7db5ac74eec06198d87174ef8 100644 --- a/product/ERP5Type/DocumentationHelper/CatalogMethodDocumentationHelper.py +++ b/product/ERP5Type/DocumentationHelper/CatalogMethodDocumentationHelper.py @@ -54,14 +54,14 @@ class CatalogMethodDocumentationHelper(DocumentationHelper): """ Returns the id of the documentation helper """ - return self.getDocumentedObject().id + return getattr(self.getDocumentedObject(), 'id', '') security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' ) def getTitle(self): """ Returns the title of the documentation helper """ - return self.getDocumentedObject().title + return getattr(self.getDocumentedObject(), 'title', '') security.declareProtected(Permissions.AccessContentsInformation, 'getSource' ) def getSource(self): @@ -69,7 +69,7 @@ class CatalogMethodDocumentationHelper(DocumentationHelper): Returns the source code of the documentation helper """ from zLOG import LOG, INFO - source_code = self.getDocumentedObject().src + source_code = getattr(self.getDocumentedObject(), 'src', '') portal_transforms = getattr(self, 'portal_transforms', None) if portal_transforms is None: LOG('DCWorkflowScriptDocumentationHelper', INFO, @@ -85,20 +85,30 @@ class CatalogMethodDocumentationHelper(DocumentationHelper): """ Returns the title of the documentation helper """ - return self.getDocumentedObject().connection_id + return getattr(self.getDocumentedObject(), 'connection_id', '') security.declareProtected(Permissions.AccessContentsInformation, 'getArgumentList' ) def getArgumentList(self): """ Returns the arguments of the documentation helper """ - return self.getDocumentedObject()._arg._keys + #return self.getDocumentedObject()._arg._keys + keys = [] + arg = getattr(self.getDocumentedObject(), '_arg', None) + if arg is not None: + keys = getattr(arg, '_keys', []) + return keys security.declareProtected(Permissions.AccessContentsInformation, 'getCatalog' ) def getCatalog(self): """ Returns the catalog name of the documentation helper """ - return self.getDocumentedObject().aq_parent.__name__ + #return self.getDocumentedObject().aq_parent.__name__ + catalog = '' + parent = getattr(self.getDocumentedObject(), 'aq_parent', None) + if parent is not None: + catalog = getattr(parent, '__name__', '') + return catalog InitializeClass(CatalogMethodDocumentationHelper) diff --git a/product/ERP5Type/DocumentationHelper/DCWorkflowDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/DCWorkflowDocumentationHelper.py index eb27cfcfabc34b2d4d26cfae6e7199dbceb6b6e6..231a347920f27f6fe017dc23822581aa3f1583fe 100644 --- a/product/ERP5Type/DocumentationHelper/DCWorkflowDocumentationHelper.py +++ b/product/ERP5Type/DocumentationHelper/DCWorkflowDocumentationHelper.py @@ -32,7 +32,6 @@ from Globals import InitializeClass from DocumentationHelper import DocumentationHelper from DocumentationSection import DocumentationSection from Products.ERP5Type import Permissions -from zLOG import LOG, INFO from Products.DCWorkflowGraph.DCWorkflowGraph import getGraph def getStatePermissionsOfRole(state=None, role=''): @@ -76,7 +75,7 @@ class DCWorkflowDocumentationHelper(DocumentationHelper): """ Returns the Id of the documentation helper """ - return self.getInstance().__name__ + return getattr(self.getInstance(), '__name__', '') security.declareProtected( Permissions.AccessContentsInformation, 'getType' ) def getType(self): @@ -90,15 +89,14 @@ class DCWorkflowDocumentationHelper(DocumentationHelper): """ Returns the title of the documentation helper """ - return self.getInstance().title + return getattr(self.getInstance(), 'title', '') security.declareProtected( Permissions.AccessContentsInformation, 'getDescription' ) def getDescription(self): """ Returns the description of the documentation helper """ - #return self.getInstance().__dict__["description"] - return self.getInstance().description + return getattr(self.getInstance(), 'description', '') @@ -152,8 +150,10 @@ class DCWorkflowDocumentationHelper(DocumentationHelper): """ """ state_list = [] - for state in self.getInstance().states.objectValues(): - state_list.append(state.getId()) + states = getattr(self.getInstance(), 'states', None) + if states is not None: + for state in states.objectValues(): + state_list.append(state.getId()) return state_list security.declareProtected( Permissions.AccessContentsInformation, 'getStateItemList' ) @@ -161,16 +161,18 @@ class DCWorkflowDocumentationHelper(DocumentationHelper): """ """ state_list = [] - for state in self.getInstance().states.objectValues(): - state_list.append((state.getId(), - state.__dict__["title"], - getStatePermissionsOfRole(state, 'Owner'), - getStatePermissionsOfRole(state, 'Assignor'), - getStatePermissionsOfRole(state, 'Assignee'), - getStatePermissionsOfRole(state, 'Associate'), - getStatePermissionsOfRole(state, 'Author'), - getStatePermissionsOfRole(state, 'Auditor') - )) + states = getattr(self.getInstance(), 'states', None) + if states is not None: + for state in states.objectValues(): + state_list.append((getattr(state, "id", ""), + getattr(state, "title", ""), + getStatePermissionsOfRole(state, 'Owner'), + getStatePermissionsOfRole(state, 'Assignor'), + getStatePermissionsOfRole(state, 'Assignee'), + getStatePermissionsOfRole(state, 'Associate'), + getStatePermissionsOfRole(state, 'Author'), + getStatePermissionsOfRole(state, 'Auditor') + )) return state_list security.declareProtected( Permissions.AccessContentsInformation, 'getStateUriList' ) @@ -197,8 +199,10 @@ class DCWorkflowDocumentationHelper(DocumentationHelper): """ """ transition_list = [] - for transition in self.getInstance().transitions.objectValues(): - transition_list.append(transition.getId()) + transitions = getattr(self.getInstance(), 'transitions', None) + if transitions is not None: + for transition in transitions.objectValues(): + transition_list.append(transition.getId()) return transition_list security.declareProtected( Permissions.AccessContentsInformation, 'getTransitionItemList' ) @@ -207,18 +211,20 @@ class DCWorkflowDocumentationHelper(DocumentationHelper): """ transition_list = [] trigger_type_list = ['Automatic','Initiated by user action','Initiated by WorkflowMethod'] - for transition in self.getInstance().transitions.objectValues(): - guard_roles = "" - guard = dir(transition.guard) - if hasattr(transition.guard, '__dict__'): - if 'roles' in transition.guard.__dict__.keys(): - guard_roles = ', '.join(role for role in transition.guard.__dict__['roles']) - transition_list.append((transition.getId(), - transition.title, - trigger_type_list[transition.trigger_type], - transition.__dict__["description"], - guard_roles - )) + transitions = getattr(self.getInstance(), 'transitions', None) + if transitions is not None: + for transition in self.getInstance().transitions.objectValues(): + guard_roles = "" + guard = dir(transition.guard) + if hasattr(transition.guard, '__dict__'): + if 'roles' in transition.guard.__dict__.keys(): + guard_roles = ', '.join(role for role in transition.guard.__dict__['roles']) + transition_list.append((transition.getId(), + getattr(transition, "title", ""), + trigger_type_list[transition.trigger_type], + getattr(transition, "description", ""), + guard_roles + )) return transition_list security.declareProtected( Permissions.AccessContentsInformation, 'getTransitionUriList' ) @@ -244,8 +250,10 @@ class DCWorkflowDocumentationHelper(DocumentationHelper): """ """ variable_list = [] - for variable in self.getInstance().variables.objectValues(): - variable_list.append(variable.getId()) + variables = getattr(self.getInstance(), 'variables', None) + if variables is not None: + for variable in variables.objectValues(): + variable_list.append(variable.getId()) return variable_list security.declareProtected( Permissions.AccessContentsInformation, 'getVariableItemList' ) @@ -253,8 +261,13 @@ class DCWorkflowDocumentationHelper(DocumentationHelper): """ """ variable_list = [] - for variable in self.getInstance().variables.objectValues(): - variable_list.append((variable.getId(), variable.title, variable.__dict__.get("description",''))) + variables = getattr(self.getInstance(), 'variables', None) + if variables is not None: + for variable in variables.objectValues(): + variable_list.append((variable.getId(), + getattr(variable, "title", ""), + getattr(variable, "description", "") + )) return variable_list security.declareProtected( Permissions.AccessContentsInformation, 'getVariableURIList' ) @@ -280,8 +293,10 @@ class DCWorkflowDocumentationHelper(DocumentationHelper): """ """ permission_list = [] - for permission in self.getInstance().permissions: - permission_list.append(permission) + permissions = getattr(self.getInstance(), "permissions", None) + if permissions is not None: + for permission in permissions: + permission_list.append(permission) return permission_list @@ -308,8 +323,10 @@ class DCWorkflowDocumentationHelper(DocumentationHelper): """ """ worklist_list = [] - for wl in self.getInstance().worklists.objectValues(): - worklist_list.append(wl.__name__) + worklists = getattr(self.getInstance(), "worklists", None) + if worklists is not None: + for wl in worklists.objectValues(): + worklist_list.append(getattr(wl, "__name__", '')) return worklist_list security.declareProtected( Permissions.AccessContentsInformation, 'getWorklistItemList' ) @@ -317,17 +334,19 @@ class DCWorkflowDocumentationHelper(DocumentationHelper): """ """ worklist_list = [] - for wl in self.getInstance().worklists.objectValues(): - guard_roles = "" - guard = dir(wl.guard) - if wl.title == "": - title = wl.actbox_name - else: - title = wl.title - if hasattr(wl.guard, '__dict__'): - if 'roles' in wl.guard.__dict__.keys(): - guard_roles = ', '.join(role for role in wl.guard.__dict__['roles']) - worklist_list.append((wl.__name__, title, wl.__dict__["description"],guard_roles)) + worklists = getattr(self.getInstance(), "worklists", None) + if worklists is not None: + for wl in worklists.objectValues(): + guard_roles = "" + guard = dir(wl.guard) + if wl.title == "": + title = wl.actbox_name + else: + title = wl.title + if hasattr(wl.guard, '__dict__'): + if 'roles' in wl.guard.__dict__.keys(): + guard_roles = ', '.join(role for role in wl.guard.__dict__['roles']) + worklist_list.append((wl.__name__, title, wl.__dict__["description"],guard_roles)) return worklist_list @@ -354,8 +373,10 @@ class DCWorkflowDocumentationHelper(DocumentationHelper): """ """ script_list = [] - for script in self.getInstance().scripts.objectValues(): - script_list.append(script.__name__) + scripts = getattr(self.getInstance(), "scripts", None) + if scripts is not None: + for script in scripts.objectValues(): + script_list.append(getattr(script, "__name__", '')) return script_list security.declareProtected( Permissions.AccessContentsInformation, 'getScriptItemList' ) @@ -363,13 +384,12 @@ class DCWorkflowDocumentationHelper(DocumentationHelper): """ """ script_list = [] - for script in self.getInstance().scripts.objectValues(): - #guard_roles = "" - #guard = dir(script.guard) - #if hasattr(script.guard, '__dict__'): - # if 'roles' in script.guard.__dict__.keys(): - # guard_roles = ', '.join(role for role in script.guard.__dict__['roles']) - script_list.append((script.__name__, script.title)) + scripts = getattr(self.getInstance(), "scripts", None) + if scripts is not None: + for script in scripts.objectValues(): + script_list.append((getattr(script, "__name__", ''), + getattr(script, "title", '') + )) return script_list @@ -404,6 +424,6 @@ class DCWorkflowDocumentationHelper(DocumentationHelper): """ Returns the graphic representation of the workflow as a PNG file """ - return getGraph(self, wf_id=self.getInstance().__name__, format=format) + return getGraph(self, wf_id=getattr(self.getInstance(), "__name__", ''), format=format) InitializeClass(DCWorkflowDocumentationHelper) diff --git a/product/ERP5Type/DocumentationHelper/DCWorkflowPermissionDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/DCWorkflowPermissionDocumentationHelper.py index b5892a449355afa60b79686685020d13c372dfed..c81c3001a4c878803a2a7528db121e32ca877ee7 100644 --- a/product/ERP5Type/DocumentationHelper/DCWorkflowPermissionDocumentationHelper.py +++ b/product/ERP5Type/DocumentationHelper/DCWorkflowPermissionDocumentationHelper.py @@ -31,7 +31,6 @@ from AccessControl import ClassSecurityInfo from Globals import InitializeClass from DocumentationHelper import DocumentationHelper from Products.ERP5Type import Permissions -from zLOG import LOG, INFO class DCWorkflowPermissionDocumentationHelper(DocumentationHelper): """ @@ -45,7 +44,7 @@ class DCWorkflowPermissionDocumentationHelper(DocumentationHelper): security.declareProtected(Permissions.AccessContentsInformation, 'getDescription') def getDescription(self): - return "" #self.getDocumentedObject().__dict__["description"] + return getattr(self.getDocumentedObject(), "description", "") security.declareProtected(Permissions.AccessContentsInformation, 'getType' ) def getType(self): @@ -59,14 +58,14 @@ class DCWorkflowPermissionDocumentationHelper(DocumentationHelper): """ Returns the id of the documentation helper """ - return "" #self.getDocumentedObject().__name__ + return getattr(self.getDocumentedObject(), "__name__", "") security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' ) def getTitle(self): """ Returns the title of the documentation helper """ - return "" #self.getDocumentedObject().title + return getattr(self.getDocumentedObject(), "title", "") security.declareProtected(Permissions.AccessContentsInformation, 'getSectionList') def getSectionList(self): diff --git a/product/ERP5Type/DocumentationHelper/DCWorkflowScriptDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/DCWorkflowScriptDocumentationHelper.py index e13e4d0a16c4811a3b83caf06ddddbaa6006d4da..d2fa6517fafc7131661b3a55e457fe4ed28b4c35 100644 --- a/product/ERP5Type/DocumentationHelper/DCWorkflowScriptDocumentationHelper.py +++ b/product/ERP5Type/DocumentationHelper/DCWorkflowScriptDocumentationHelper.py @@ -55,7 +55,7 @@ class DCWorkflowScriptDocumentationHelper(DocumentationHelper): """ Returns the id of the documentation helper """ - return self.getDocumentedObject().__name__ + return getattr(self.getDocumentedObject(), "__name__", "") security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' ) @@ -63,7 +63,7 @@ class DCWorkflowScriptDocumentationHelper(DocumentationHelper): """ Returns the title of the documentation helper """ - return self.getDocumentedObject().title + return getattr(self.getDocumentedObject(), "title", "") security.declareProtected(Permissions.AccessContentsInformation, 'getSectionList') def getSectionList(self): diff --git a/product/ERP5Type/DocumentationHelper/DCWorkflowStateDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/DCWorkflowStateDocumentationHelper.py index 9810b7d87b75f8fa3a105828150be87aec76252b..f12e6f96c8dc70c591bd39a495e3a280f6123adf 100644 --- a/product/ERP5Type/DocumentationHelper/DCWorkflowStateDocumentationHelper.py +++ b/product/ERP5Type/DocumentationHelper/DCWorkflowStateDocumentationHelper.py @@ -31,7 +31,6 @@ from AccessControl import ClassSecurityInfo from Globals import InitializeClass from DocumentationHelper import DocumentationHelper from Products.ERP5Type import Permissions -from zLOG import LOG, INFO def getPermissionsOfRole(state=None, role=''): """ @@ -41,7 +40,6 @@ def getPermissionsOfRole(state=None, role=''): M = Modify Portal Content C = Add Portal Content """ - #LOG('yoooo', INFO, 'state=%s role=%s ' % (state, role)) permissions = "" if state != None: if hasattr(state, '__dict__'): @@ -87,7 +85,7 @@ class DCWorkflowStateDocumentationHelper(DocumentationHelper): """ Returns the id of the documentation helper """ - return self.getDocumentedObject().__name__ + return getattr(self.getDocumentedObject(), "__name__", "") security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' ) @@ -95,7 +93,7 @@ class DCWorkflowStateDocumentationHelper(DocumentationHelper): """ Returns the title of the documentation helper """ - return self.getDocumentedObject().__dict__["title"] + return getattr(self.getDocumentedObject(), "title", "") def getSectionList(self): """ @@ -108,7 +106,7 @@ class DCWorkflowStateDocumentationHelper(DocumentationHelper): """ Returns list of possible transitions from this state """ - return self.getDocumentedObject().transitions + return getattr(self.getDocumentedObject(), "transitions", []) security.declareProtected( Permissions.AccessContentsInformation, 'getPermissionsOfRoleOwner' ) def getPermissionsOfRoleOwner(self): diff --git a/product/ERP5Type/DocumentationHelper/DCWorkflowTransitionDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/DCWorkflowTransitionDocumentationHelper.py index 26d7e0ef8ba7a6864ab66e683d390f0c387e4186..504706d3fcc2c0bc6225607e1410d589e922bae4 100644 --- a/product/ERP5Type/DocumentationHelper/DCWorkflowTransitionDocumentationHelper.py +++ b/product/ERP5Type/DocumentationHelper/DCWorkflowTransitionDocumentationHelper.py @@ -31,7 +31,6 @@ from AccessControl import ClassSecurityInfo from Globals import InitializeClass from DocumentationHelper import DocumentationHelper from Products.ERP5Type import Permissions -from zLOG import LOG, INFO class DCWorkflowTransitionDocumentationHelper(DocumentationHelper): """ @@ -45,7 +44,8 @@ class DCWorkflowTransitionDocumentationHelper(DocumentationHelper): security.declareProtected(Permissions.AccessContentsInformation, 'getDescription') def getDescription(self): - return self.getDocumentedObject().__dict__["description"] + #return self.getDocumentedObject().__dict__["description"] + return getattr(self.getDocumentedObject(), "description", "") security.declareProtected(Permissions.AccessContentsInformation, 'getType' ) def getType(self): @@ -59,14 +59,14 @@ class DCWorkflowTransitionDocumentationHelper(DocumentationHelper): """ Returns the id of the documentation helper """ - return self.getDocumentedObject().__name__ + return getattr(self.getDocumentedObject(), "__name__", "") security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' ) def getTitle(self): """ Returns the title of the documentation helper """ - return self.getDocumentedObject().title + return getattr(self.getDocumentedObject(), "title", "") security.declareProtected( Permissions.AccessContentsInformation, 'getSectionList' ) def getSectionList(self): @@ -80,7 +80,7 @@ class DCWorkflowTransitionDocumentationHelper(DocumentationHelper): """ Returns the id of the new state for de workflow transition """ - return self.getDocumentedObject().new_state_id + return getattr(self.getDocumentedObject(), "new_state_id", '') security.declareProtected(Permissions.AccessContentsInformation, 'getTriggerType' ) def getTriggerType(self): @@ -88,7 +88,7 @@ class DCWorkflowTransitionDocumentationHelper(DocumentationHelper): Returns the trigger type for de workflow transition """ trigger_type_list = ['Automatic','Initiated by user action','Initiated by WorkflowMethod'] - trigger_type_id = self.getDocumentedObject().trigger_type + trigger_type_id = getattr(self.getDocumentedObject(), "trigger_type", '') return trigger_type_list[trigger_type_id] security.declareProtected(Permissions.AccessContentsInformation, 'getScriptName' ) @@ -96,14 +96,14 @@ class DCWorkflowTransitionDocumentationHelper(DocumentationHelper): """ Returns the name of the script for de workflow transition """ - return self.getDocumentedObject().script_name + return getattr(self.getDocumentedObject(), "script_name", '') security.declareProtected(Permissions.AccessContentsInformation, 'getAfterScriptName' ) def getAfterScriptName(self): """ Returns the name of the script for de workflow transition """ - return self.getDocumentedObject().after_script_name + return getattr(self.getDocumentedObject(), "after_script_name", '') security.declareProtected(Permissions.AccessContentsInformation, 'getAvailableStateIds' ) def getAvailableStateIds(self): @@ -121,8 +121,6 @@ class DCWorkflowTransitionDocumentationHelper(DocumentationHelper): if hasattr(self.getDocumentedObject(),'guard'): dir(self.getDocumentedObject().guard) if hasattr(self.getDocumentedObject().guard, '__dict__'): - #LOG('baye... 3', INFO, 'dict=%s' % dir(self.getDocumentedObject().guard.__dict__)) - #self.getDocumentedObject().guard.__dict__ if 'roles' in self.getDocumentedObject().guard.__dict__.keys(): role_list = self.getDocumentedObject().guard.__dict__['roles'] return ', '.join(role for role in role_list) diff --git a/product/ERP5Type/DocumentationHelper/DCWorkflowVariableDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/DCWorkflowVariableDocumentationHelper.py index a41257538cb3d4d642f2450e4ed7272e4fec4a0b..e5a1365360de85de56ae292b93982e4f972b5a08 100644 --- a/product/ERP5Type/DocumentationHelper/DCWorkflowVariableDocumentationHelper.py +++ b/product/ERP5Type/DocumentationHelper/DCWorkflowVariableDocumentationHelper.py @@ -31,7 +31,6 @@ from AccessControl import ClassSecurityInfo from Globals import InitializeClass from DocumentationHelper import DocumentationHelper from Products.ERP5Type import Permissions -from zLOG import LOG, INFO class DCWorkflowVariableDocumentationHelper(DocumentationHelper): """ @@ -45,7 +44,7 @@ class DCWorkflowVariableDocumentationHelper(DocumentationHelper): security.declareProtected(Permissions.AccessContentsInformation, 'getDescription') def getDescription(self): - return self.getDocumentedObject().__dict__["description"] + return getattr(self.getDocumentedObject(), "description", '') security.declareProtected(Permissions.AccessContentsInformation, 'getType' ) def getType(self): @@ -59,7 +58,7 @@ class DCWorkflowVariableDocumentationHelper(DocumentationHelper): """ Returns the id of the documentation helper """ - return self.getDocumentedObject().__name__ + return getattr(self.getDocumentedObject(), "__name__", '') security.declareProtected( Permissions.AccessContentsInformation, 'getSectionList' ) def getSectionList(self): @@ -73,7 +72,7 @@ class DCWorkflowVariableDocumentationHelper(DocumentationHelper): """ Returns the title of the documentation helper """ - return self.getDocumentedObject().title + return getattr(self.getDocumentedObject(), "title", '') security.declareProtected(Permissions.AccessContentsInformation, 'getDefaultExpression' ) def getDefaultExpression(self): @@ -81,7 +80,7 @@ class DCWorkflowVariableDocumentationHelper(DocumentationHelper): Returns the Default Expression of the documentation helper """ default_expr = "" - if self.getDocumentedObject().default_expr != None: + if getattr(self.getDocumentedObject(), "default_expr", None) is not None: default_expr = self.getDocumentedObject().default_expr.text return default_expr diff --git a/product/ERP5Type/DocumentationHelper/DCWorkflowWorklistDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/DCWorkflowWorklistDocumentationHelper.py index 950d989ff4b52bdce0e8a829b0424dead83725a0..f8ee8d6ef1db4cb6f56b2609b848d358b4b0ab7a 100644 --- a/product/ERP5Type/DocumentationHelper/DCWorkflowWorklistDocumentationHelper.py +++ b/product/ERP5Type/DocumentationHelper/DCWorkflowWorklistDocumentationHelper.py @@ -31,7 +31,6 @@ from AccessControl import ClassSecurityInfo from Globals import InitializeClass from DocumentationHelper import DocumentationHelper from Products.ERP5Type import Permissions -from zLOG import LOG, INFO class DCWorkflowWorklistDocumentationHelper(DocumentationHelper): """ @@ -45,7 +44,7 @@ class DCWorkflowWorklistDocumentationHelper(DocumentationHelper): security.declareProtected(Permissions.AccessContentsInformation, 'getDescription') def getDescription(self): - return self.getDocumentedObject().__dict__["description"] + return getattr(self.getDocumentedObject(), "description", '') security.declareProtected(Permissions.AccessContentsInformation, 'getType' ) def getType(self): @@ -59,7 +58,7 @@ class DCWorkflowWorklistDocumentationHelper(DocumentationHelper): """ Returns the id of the documentation helper """ - return self.getDocumentedObject().__name__ + return getattr(self.getDocumentedObject(), "__name__", '') security.declareProtected( Permissions.AccessContentsInformation, 'getSectionList' ) def getSectionList(self): diff --git a/product/ERP5Type/DocumentationHelper/DocumentationHelper.py b/product/ERP5Type/DocumentationHelper/DocumentationHelper.py index 8b7bd3ed15609ad33935c67045505eaeb1a02d2f..77e4f1e5927c1fd7f44b7b53620efaa4ef5bd03b 100644 --- a/product/ERP5Type/DocumentationHelper/DocumentationHelper.py +++ b/product/ERP5Type/DocumentationHelper/DocumentationHelper.py @@ -31,8 +31,43 @@ from AccessControl import ClassSecurityInfo from Globals import InitializeClass from Products.ERP5Type import Permissions from App.config import getConfiguration -from zLOG import LOG, INFO import os +import random + + +class TempObjectLibrary(object): + """Create temporary objets of any portal type. + + The purpose of this class is to deal with the fact that a portal type may + filter content types. For each requested portal type, this class creates the + required tree of temporary objects. + All created objects are cached. + """ + 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.portal_type_dict = {} + self.dependency_dict = {} + for type_info in container._getTypesTool().listTypeInfo(): + for allowed in type_info.allowed_content_types: + if allowed != type_info.id: + self.dependency_dict.setdefault(allowed, []).append(type_info.id) + + def __call__(self, portal_type): + """Returns a temporary instance of the given portal_type.""" + temp_object = self.portal_type_dict.get(portal_type) + if temp_object is None: + possible_parent_list = self.dependency_dict.get(portal_type) + if possible_parent_list: + # Note that the dependency graph may contain cycles, + # so we use the most simple pathfinding algorithm: random. + container = self(random.choice(possible_parent_list)) + else: + container = self.root + temp_object = container.newContent(portal_type=portal_type, temp_object=1) + self.portal_type_dict[portal_type] = temp_object + return temp_object class DocumentationHelper(Implicit): """ @@ -56,12 +91,22 @@ class DocumentationHelper(Implicit): def __init__(self, uri): self.uri = uri + security.declareProtected( Permissions.AccessContentsInformation, 'getTempInstance' ) + def getTempInstance(self, portal_type): + """ + Returns a temporary instance of the given portal_type + """ + self.getTempInstance = TempObjectLibrary(self.getPortalObject().portal_classes) + return self.getTempInstance(portal_type) + def getDocumentedObject(self): if self.uri.startswith('portal_classes/temp_instance'): - url, method = self.uri.split('#') - portal_type = url.split('/')[-1] - temp_folder = self.getPortalObject().portal_classes.newContent(id='temp_instance', portal_type='Folder', temp_object=1) - temp_object = temp_folder.newContent(id=portal_type, portal_type=portal_type, temp_object=1) + url, method = self.uri.split('#') + portal_type = url.split('/')[-1] + #temp_folder = self.getPortalObject().portal_classes.newContent(id='temp_instance', portal_type='Folder', temp_object=1) + #temp_object = temp_folder.newContent(id=portal_type, portal_type=portal_type, temp_object=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) else: @@ -76,11 +121,11 @@ class DocumentationHelper(Implicit): zope_property_sheet = instance_home + '/PropertySheet' list_propertysheets = [zope_property_sheet,] for path in list_path: - full_path = instance_home+'/Products/'+path + full_path = instance_home+'/Products/'+path if os.path.isdir(full_path) and os.path.exists(full_path+'/PropertySheet'): list_propertysheets.append(full_path+'/PropertySheet') for propertysheet_directory in list_propertysheets: - if os.path.exists(propertysheet_directory+'/'+file_name): + if os.path.exists(propertysheet_directory+'/'+file_name): file_url = propertysheet_directory+'/'+file_name documented_object = open(file_url) elif '/' in self.uri and '#' not in self.uri: @@ -89,20 +134,20 @@ class DocumentationHelper(Implicit): try: documented_object = self.getPortalObject().portal_categories.resolveCategory(self.uri) except: - documented_object = None + documented_object = None if documented_object is None: - documented_object = self.getPortalObject().unrestrictedTraverse(self.uri) + documented_object = self.getPortalObject().unrestrictedTraverse(self.uri) elif '/' in self.uri and '#' in self.uri: if '?' in self.uri: - base_url, url = self.uri.split('?') - type, name = url.split('#') - parent_object = self.getPortalObject().unrestrictedTraverse(base_url) - object_list = getattr(parent_object, type, None) - documented_object = None - if object_list is not None: + base_url, url = self.uri.split('?') + type, name = url.split('#') + parent_object = self.getPortalObject().unrestrictedTraverse(base_url) + object_list = getattr(parent_object, type, None) + documented_object = None + if object_list is not None: for obj in object_list: - if obj.__name__ == name: - documented_object = obj + if obj.__name__ == name: + documented_object = obj else: url, method = self.uri.split('#') documented_object = self.getPortalObject().unrestrictedTraverse(url) @@ -124,10 +169,9 @@ class DocumentationHelper(Implicit): import Products documented_object = Products for key in module_list[1:]: - #LOG('Baye, loop in module_list', 0,'do=%s et uri=%s' % (repr(documented_object), self.uri)) documented_object = getattr(documented_object, key) else: - raise NotImplemented + raise NotImplemented #fp, pathname, description = imp.find_module(base_module) #documented_object = imp.load_module(fp, pathname, description) return documented_object diff --git a/product/ERP5Type/DocumentationHelper/ERP5FormDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/ERP5FormDocumentationHelper.py index b490c0529a5220b1683ed63c2e97f59a546cd66b..3cd5d4713874972dd8b61bbfe7f3302b1658dbee 100644 --- a/product/ERP5Type/DocumentationHelper/ERP5FormDocumentationHelper.py +++ b/product/ERP5Type/DocumentationHelper/ERP5FormDocumentationHelper.py @@ -54,20 +54,20 @@ class ERP5FormDocumentationHelper(DocumentationHelper): """ Returns the id of the documentation helper """ - return self.getDocumentedObject().id + return getattr(self.getDocumentedObject(), "id", '') security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' ) def getTitle(self): """ Returns the title of the documentation helper """ - return self.getDocumentedObject().title + return getattr(self.getDocumentedObject(), "title", '') security.declareProtected( Permissions.AccessContentsInformation, 'getEncoding' ) def getEncoding(self): """ Returns the encoding of the ERP5 Form """ - return self.getDocumentedObject().encoding + return getattr(self.getDocumentedObject(), "encoding", '') InitializeClass(ERP5FormDocumentationHelper) diff --git a/product/ERP5Type/DocumentationHelper/ERP5SiteDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/ERP5SiteDocumentationHelper.py index d975a681dc6a790f4118c90edc456537b73afec5..d554f51ae9388ff5fa672986c050eca5bdf68369 100644 --- a/product/ERP5Type/DocumentationHelper/ERP5SiteDocumentationHelper.py +++ b/product/ERP5Type/DocumentationHelper/ERP5SiteDocumentationHelper.py @@ -33,7 +33,6 @@ from Globals import InitializeClass from DocumentationHelper import DocumentationHelper from DocumentationSection import DocumentationSection from Products.ERP5Type import Permissions -from zLOG import LOG, INFO class ERP5SiteDocumentationHelper(DocumentationHelper): """ @@ -50,7 +49,7 @@ class ERP5SiteDocumentationHelper(DocumentationHelper): """ Returns the title of the documentation helper """ - return self.getDocumentedObject().title + return getattr(self.getDocumentedObject(), "title", '') security.declareProtected( Permissions.AccessContentsInformation, 'getType' ) def getType(self): @@ -79,7 +78,7 @@ class ERP5SiteDocumentationHelper(DocumentationHelper): """ Returns the description of the documentation helper """ - return self.getDocumentedObject().description + return getattr(self.getDocumentedObject(), "description", '') security.declareProtected( Permissions.AccessContentsInformation, 'getBusinessTemplateIdList' ) def getBusinessTemplateIdList(self): @@ -99,18 +98,19 @@ class ERP5SiteDocumentationHelper(DocumentationHelper): """ """ bt_list = [] - for bt in self.getDocumentedObject().portal_templates.objectValues(): - revision = "" - version = "" - if hasattr(bt, 'revision'): - revision = bt.revision - if hasattr(bt, 'version'): - version = bt.version - current_state = '' - for wh in bt.workflow_history['business_template_installation_workflow']: - current_state = wh['installation_state'] - if current_state == 'installed': - bt_list.append((bt.getId(), bt.title, bt.description, version, revision)) + portal_templates = getattr(self.getDocumentedObject(), "portal_templates", None) + if portal_templates is not None: + for bt in portal_templates.objectValues(): + current_state = '' + for wh in bt.workflow_history['business_template_installation_workflow']: + current_state = wh['installation_state'] + if current_state == 'installed': + bt_list.append((bt.getId(), + getattr(bt, "title", ''), + getattr(bt, "description", ''), + getattr(bt, "version", ''), + getattr(bt, "revision", '') + )) return bt_list security.declareProtected( Permissions.AccessContentsInformation, 'getBusinessTemplateURIList' ) diff --git a/product/ERP5Type/DocumentationHelper/InteractionWorkflowDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/InteractionWorkflowDocumentationHelper.py index f2a83a24dac531fcbfed17c1e1b7283b40dbed57..22cb8843df9c1dcfe881f600d7b1a66538beda74 100644 --- a/product/ERP5Type/DocumentationHelper/InteractionWorkflowDocumentationHelper.py +++ b/product/ERP5Type/DocumentationHelper/InteractionWorkflowDocumentationHelper.py @@ -32,7 +32,6 @@ from Globals import InitializeClass from DocumentationHelper import DocumentationHelper from DocumentationSection import DocumentationSection from Products.ERP5Type import Permissions -from zLOG import LOG, INFO from Products.DCWorkflowGraph.DCWorkflowGraph import getGraph def getStatePermissionsOfRole(state=None, role=''): @@ -76,7 +75,8 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper): """ Returns the Id of the documentation helper """ - return self.getInstance().__name__ + return getattr(self.getInstance(), "__name__", '') + security.declareProtected( Permissions.AccessContentsInformation, 'getType' ) def getType(self): @@ -90,14 +90,14 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper): """ Returns the title of the documentation helper """ - return self.getInstance().title + return getattr(self.getInstance(), "title", '') security.declareProtected( Permissions.AccessContentsInformation, 'getDescription' ) def getDescription(self): """ Returns the description of the documentation helper """ - return self.getInstance().description + return getattr(self.getInstance(), "description", '') security.declareProtected( Permissions.AccessContentsInformation, 'getSectionList' ) @@ -150,8 +150,10 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper): """ """ state_list = [] - for state in self.getInstance().states.objectValues(): - state_list.append(state.getId()) + if hasattr(self.getInstance(), "states"): + if self.getInstance().states is not None: + for state in self.getInstance().states.objectValues(): + state_list.append(state.getId()) return state_list security.declareProtected( Permissions.AccessContentsInformation, 'getStateItemList' ) @@ -159,16 +161,18 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper): """ """ state_list = [] - for state in self.getInstance().states.objectValues(): - state_list.append((state.getId(), - state.__dict__["title"], - getStatePermissionsOfRole(state, 'Owner'), - getStatePermissionsOfRole(state, 'Assignor'), - getStatePermissionsOfRole(state, 'Assignee'), - getStatePermissionsOfRole(state, 'Associate'), - getStatePermissionsOfRole(state, 'Author'), - getStatePermissionsOfRole(state, 'Auditor') - )) + if hasattr(self.getInstance(), "states"): + if self.getInstance().states is not None: + for state in self.getInstance().states.objectValues(): + state_list.append((state.getId(), + state.__dict__["title"], + getStatePermissionsOfRole(state, 'Owner'), + getStatePermissionsOfRole(state, 'Assignor'), + getStatePermissionsOfRole(state, 'Assignee'), + getStatePermissionsOfRole(state, 'Associate'), + getStatePermissionsOfRole(state, 'Author'), + getStatePermissionsOfRole(state, 'Auditor') + )) return state_list security.declareProtected( Permissions.AccessContentsInformation, 'getStateUriList' ) @@ -195,8 +199,10 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper): """ """ transition_list = [] - for transition in self.getInstance().transitions.objectValues(): - transition_list.append(transition.getId()) + if hasattr(self.getInstance(), "transitions"): + if self.getInstance().transitions is not None: + for transition in self.getInstance().transitions.objectValues(): + transition_list.append(transition.getId()) return transition_list security.declareProtected( Permissions.AccessContentsInformation, 'getTransitionItemList' ) @@ -205,18 +211,20 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper): """ transition_list = [] trigger_type_list = ['Automatic','Initiated by user action','Initiated by WorkflowMethod'] - for transition in self.getInstance().transitions.objectValues(): - guard_roles = "" - guard = dir(transition.guard) - if hasattr(transition.guard, '__dict__'): - if 'roles' in transition.guard.__dict__.keys(): - guard_roles = ', '.join(role for role in transition.guard.__dict__['roles']) - transition_list.append((transition.getId(), - transition.title, - trigger_type_list[transition.trigger_type], - transition.__dict__["description"], - guard_roles - )) + if hasattr(self.getInstance(), "transitions"): + if self.getInstance().transitions is not None: + for transition in self.getInstance().transitions.objectValues(): + guard_roles = "" + guard = dir(transition.guard) + if hasattr(transition.guard, '__dict__'): + if 'roles' in transition.guard.__dict__.keys(): + guard_roles = ', '.join(role for role in transition.guard.__dict__['roles']) + transition_list.append((transition.getId(), + transition.title, + trigger_type_list[transition.trigger_type], + transition.__dict__["description"], + guard_roles + )) return transition_list security.declareProtected( Permissions.AccessContentsInformation, 'getTransitionUriList' ) @@ -242,8 +250,10 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper): """ """ variable_list = [] - for variable in self.getInstance().variables.objectValues(): - variable_list.append(variable.getId()) + if hasattr(self.getInstance(), "variables"): + if self.getInstance().variables is not None: + for variable in self.getInstance().variables.objectValues(): + variable_list.append(variable.getId()) return variable_list security.declareProtected( Permissions.AccessContentsInformation, 'getVariableItemList' ) @@ -251,8 +261,10 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper): """ """ variable_list = [] - for variable in self.getInstance().variables.objectValues(): - variable_list.append((variable.getId(), variable.title, variable.__dict__["description"])) + if hasattr(self.getInstance(), "variables"): + if self.getInstance().variables is not None: + for variable in self.getInstance().variables.objectValues(): + variable_list.append((variable.getId(), variable.title, variable.__dict__["description"])) return variable_list security.declareProtected( Permissions.AccessContentsInformation, 'getVariableURIList' ) @@ -278,8 +290,10 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper): """ """ permission_list = [] - for permission in self.getInstance().permissions: - permission_list.append(permission) + if hasattr(self.getInstance(), "permissions"): + if self.getInstance().permissions is not None: + for permission in self.getInstance().permissions: + permission_list.append(permission) return permission_list @@ -306,8 +320,10 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper): """ """ worklist_list = [] - for wl in self.getInstance().worklists.objectValues(): - worklist_list.append(wl.__name__) + if hasattr(self.getInstance(), "worklists"): + if self.getInstance().worklists is not None: + for wl in self.getInstance().worklists.objectValues(): + worklist_list.append(wl.__name__) return worklist_list security.declareProtected( Permissions.AccessContentsInformation, 'getWorklistItemList' ) @@ -315,17 +331,19 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper): """ """ worklist_list = [] - for wl in self.getInstance().worklists.objectValues(): - guard_roles = "" - guard = dir(wl.guard) - if wl.title == "": - title = wl.actbox_name - else: - title = wl.title - if hasattr(wl.guard, '__dict__'): - if 'roles' in wl.guard.__dict__.keys(): - guard_roles = ', '.join(role for role in wl.guard.__dict__['roles']) - worklist_list.append((wl.__name__, title, wl.__dict__["description"],guard_roles)) + if hasattr(self.getInstance(), "worklists"): + if self.getInstance().worklists is not None: + for wl in self.getInstance().worklists.objectValues(): + guard_roles = "" + guard = dir(wl.guard) + if wl.title == "": + title = wl.actbox_name + else: + title = wl.title + if hasattr(wl.guard, '__dict__'): + if 'roles' in wl.guard.__dict__.keys(): + guard_roles = ', '.join(role for role in wl.guard.__dict__['roles']) + worklist_list.append((wl.__name__, title, wl.__dict__["description"],guard_roles)) return worklist_list @@ -352,8 +370,10 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper): """ """ script_list = [] - for script in self.getInstance().scripts.objectValues(): - script_list.append(script.__name__) + if hasattr(self.getInstance(), "scripts"): + if self.getInstance().scripts is not None: + for script in self.getInstance().scripts.objectValues(): + script_list.append(script.__name__) return script_list security.declareProtected( Permissions.AccessContentsInformation, 'getScriptItemList' ) @@ -361,13 +381,10 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper): """ """ script_list = [] - for script in self.getInstance().scripts.objectValues(): - #guard_roles = "" - #guard = dir(script.guard) - #if hasattr(script.guard, '__dict__'): - # if 'roles' in script.guard.__dict__.keys(): - # guard_roles = ', '.join(role for role in script.guard.__dict__['roles']) - script_list.append((script.__name__, script.title)) + if hasattr(self.getInstance(), "scripts"): + if self.getInstance().scripts is not None: + for script in self.getInstance().scripts.objectValues(): + script_list.append((script.__name__, script.title)) return script_list diff --git a/product/ERP5Type/DocumentationHelper/PageTemplateDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/PageTemplateDocumentationHelper.py index 7e32034b0ed77d4d5899074d81be58ff5745d8dd..88249f3273681999bf57da54bd867e62e6b9b906 100644 --- a/product/ERP5Type/DocumentationHelper/PageTemplateDocumentationHelper.py +++ b/product/ERP5Type/DocumentationHelper/PageTemplateDocumentationHelper.py @@ -54,14 +54,15 @@ class PageTemplateDocumentationHelper(DocumentationHelper): """ Returns the id of the documentation helper """ - return self.getDocumentedObject().id + return getattr(self.getDocumentedObject(), "id", '') + security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' ) def getTitle(self): """ Returns the title of the documentation helper """ - return self.getDocumentedObject().title + return getattr(self.getDocumentedObject(), "title", '') security.declareProtected( Permissions.AccessContentsInformation, 'getSourceCode' ) def getSourceCode(self): @@ -69,7 +70,7 @@ class PageTemplateDocumentationHelper(DocumentationHelper): Returns the source code the script python """ from zLOG import LOG, INFO - source_code = self.getDocumentedObject()._text + source_code = getattr(self.getDocumentedObject(), "_text", '') portal_transforms = getattr(self, 'portal_transforms', None) if portal_transforms is None: LOG('DCWorkflowScriptDocumentationHelper', INFO, diff --git a/product/ERP5Type/DocumentationHelper/PortalTypeActionDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/PortalTypeActionDocumentationHelper.py index 6e7497dde2cdfdb4a23878f3b07022e9a379f68d..9cca2efd77a6210036e83f3a3471812cbaa0a04d 100644 --- a/product/ERP5Type/DocumentationHelper/PortalTypeActionDocumentationHelper.py +++ b/product/ERP5Type/DocumentationHelper/PortalTypeActionDocumentationHelper.py @@ -31,7 +31,6 @@ from AccessControl import ClassSecurityInfo from Globals import InitializeClass from DocumentationHelper import DocumentationHelper from Products.ERP5Type import Permissions -from zLOG import LOG, INFO class PortalTypeActionDocumentationHelper(DocumentationHelper): """ @@ -45,7 +44,7 @@ class PortalTypeActionDocumentationHelper(DocumentationHelper): security.declareProtected(Permissions.AccessContentsInformation, 'getDescription') def getDescription(self): - return self.getDocumentedObject().Description() + return getattr(self.getDocumentedObject(), "description", '') security.declareProtected(Permissions.AccessContentsInformation, 'getType' ) def getType(self): @@ -59,7 +58,7 @@ class PortalTypeActionDocumentationHelper(DocumentationHelper): """ Returns the id of the documentation helper """ - return self.getDocumentedObject().__name__ + return getattr(self.getDocumentedObject(), "__name__", '') security.declareProtected( Permissions.AccessContentsInformation, 'getSectionList' ) def getSectionList(self): @@ -73,14 +72,15 @@ class PortalTypeActionDocumentationHelper(DocumentationHelper): """ Returns the title of the documentation helper """ - return self.getDocumentedObject().title + return getattr(self.getDocumentedObject(), "title", '') security.declareProtected(Permissions.AccessContentsInformation, 'getPermissions' ) def getPermissions(self): """ Returns the permissions of the documentation helper """ - return ', '.join(x for x in self.getDocumentedObject().permissions) + permissions = getattr(self.getDocumentedObject(), "permissions", []) + return ', '.join(x for x in permissions) security.declareProtected(Permissions.AccessContentsInformation, 'getVisible' ) def getVisible(self): @@ -88,13 +88,13 @@ class PortalTypeActionDocumentationHelper(DocumentationHelper): Returns the visibility of the documentation helper """ TITLE =['No', 'Yes'] - return TITLE[self.getDocumentedObject().visible] + return TITLE[getattr(self.getDocumentedObject(), "visible", 0)] security.declareProtected(Permissions.AccessContentsInformation, 'getCategory' ) def getCategory(self): """ Returns the category of the documentation helper """ - return self.getDocumentedObject().category + return getattr(self.getDocumentedObject(), "category", '') InitializeClass(PortalTypeActionDocumentationHelper) diff --git a/product/ERP5Type/DocumentationHelper/PortalTypeDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/PortalTypeDocumentationHelper.py index 86c39502594f266626c4f70eb7bf80fd7ff348ec..04b96efc19c24d6aaa1bdfb3d272f2a81f11b9df 100644 --- a/product/ERP5Type/DocumentationHelper/PortalTypeDocumentationHelper.py +++ b/product/ERP5Type/DocumentationHelper/PortalTypeDocumentationHelper.py @@ -29,11 +29,10 @@ from Acquisition import Implicit from AccessControl import ClassSecurityInfo from Globals import InitializeClass -from DocumentationHelper import DocumentationHelper +from DocumentationHelper import DocumentationHelper, TempObjectLibrary from DocumentationSection import DocumentationSection from PortalTypeInstanceDocumentationHelper import PortalTypeInstanceDocumentationHelper from Products.ERP5Type import Permissions -from zLOG import LOG, INFO def getPortalType(uri=''): """ @@ -86,12 +85,12 @@ class PortalTypeDocumentationHelper(DocumentationHelper): security.declareProtected( Permissions.AccessContentsInformation, 'getTempInstance' ) - def getTempInstance(self, portal_type=''): + def getTempInstance(self, portal_type): """ Returns a temporary instance of the given portal_type """ - temp_folder = self.getPortalObject().portal_classes.newContent(id='temp_instance', portal_type='Folder', temp_object=1) - return temp_folder.newContent(id=portal_type, portal_type=portal_type, temp_object=1) + self.getTempInstance = TempObjectLibrary(self.getPortalObject().portal_classes) + return self.getTempInstance(portal_type) security.declareProtected( Permissions.AccessContentsInformation, 'getSectionList' ) def getSectionList(self): @@ -133,13 +132,13 @@ class PortalTypeDocumentationHelper(DocumentationHelper): id='workflow_method', title='Workflow Method', class_name='WorkflowMethodDocumentationHelper', - uri_list=self.getWorkflowMethodURIList(inherited=0), + uri_list=self.getWorkflowMethodUriList(inherited=0), ), DocumentationSection( id='accessor', title='Accessor', class_name='AccessorMethodDocumentationHelper', - uri_list=self.getAccessorMethodURIList(inherited=0), + uri_list=self.getAccessorMethodUriList(inherited=0), ), DocumentationSection( id='class_method', @@ -162,7 +161,7 @@ class PortalTypeDocumentationHelper(DocumentationHelper): """ Returns the list of allowed content type of the documentation helper """ - return self.getDocumentedObject().allowed_content_types + return getattr(self.getDocumentedObject(), "allowed_content_types", []) security.declareProtected( Permissions.AccessContentsInformation, 'getAllowedContentTypeURIList' ) def getAllowedContentTypeURIList(self): @@ -177,7 +176,7 @@ class PortalTypeDocumentationHelper(DocumentationHelper): """ Returns the list of hidden content type of the documentation helper """ - return self.getDocumentedObject().hidden_content_type_list + return getattr(self.getDocumentedObject(), "hidden_content_type_list", []) security.declareProtected( Permissions.AccessContentsInformation, 'getHiddenContentTypeURIList' ) def getHiddenContentTypeURIList(self): @@ -192,14 +191,15 @@ class PortalTypeDocumentationHelper(DocumentationHelper): """ Returns the list of base category of the documentation helper """ - return self.getDocumentedObject().base_category_list + return getattr(self.getDocumentedObject(), "base_category_list", []) security.declareProtected( Permissions.AccessContentsInformation, 'getAcquireLocalRoles' ) def getAcquireLocalRoles(self): """ Returns the list of allowed content type for the documentation helper """ - if self.getDocumentedObject().acquire_local_roles: + local_roles = getattr(self.getDocumentedObject(), "acquire_local_roles", '') + if local_roles: return 'Yes' else: return 'No' @@ -209,7 +209,8 @@ class PortalTypeDocumentationHelper(DocumentationHelper): """ Returns the list of property sheets for the documentation helper """ - temp_object = self.getTempInstance(self.getDocumentedObject().id) + id = getattr(self.getDocumentedObject(), "id", '') + temp_object = self.getTempInstance(id) property_sheet = [] for obj in temp_object.property_sheets: property_sheet.append(obj.__module__.split('.')[-1]) @@ -230,14 +231,15 @@ class PortalTypeDocumentationHelper(DocumentationHelper): """ Returns the list of groups for the documentation helper """ - return self.getDocumentedObject().group_list + return getattr(self.getDocumentedObject(), "group_list", []) security.declareProtected( Permissions.AccessContentsInformation, 'getActionIdList' ) def getActionIdList(self): """ """ action_list = [] - for action in self.getDocumentedObject()._actions: + actions = getattr(self.getDocumentedObject(), "_actions", []) + for action in actions: action_list.append(action.getId()) return action_list @@ -277,7 +279,8 @@ class PortalTypeDocumentationHelper(DocumentationHelper): """ """ role_list = [] - for role in self.getDocumentedObject()._roles: + roles = getattr(self.getDocumentedObject(), "_roles", '') + for role in roles: role_list.append(role.Title()) return role_list @@ -312,7 +315,6 @@ class PortalTypeDocumentationHelper(DocumentationHelper): from Products.ERP5Type.Base import Base portal_type = getPortalType(self.uri) temp_object = self.getTempInstance(portal_type) - #LOG('yomido1', INFO, 'dir() = %s' % dir(temp_object)) dir_temp = dir(temp_object) return Base.aq_portal_type[(portal_type, temp_object.__class__)] @@ -334,6 +336,20 @@ class PortalTypeDocumentationHelper(DocumentationHelper): module = klass.__module__ uri_prefix = '' #'%s.%s.' % (module, class_name) return map(lambda x: '%s%s' % (uri_prefix, x), method_id_list) + + security.declareProtected(Permissions.AccessContentsInformation, 'getWorkflowMethodUriList' ) + def getWorkflowMethodUriList(self, inherited=1, local=1): + """ + Returns a list of URIs to workflow methods + """ + method_id_list = self.getWorkflowMethodIdList() + portal_type = getPortalType(self.uri) + klass = self.getTempInstance(portal_type).__class__ + class_name = klass.__name__ + module = klass.__module__ + uri_prefix = 'portal_classes/temp_instance/%s' % self.uri.split('/')[-1] + return map(lambda x: '%s#%s' % (uri_prefix, x), method_id_list) + security.declareProtected( Permissions.AccessContentsInformation, 'getClassMethodIdList' ) def getClassMethodIdList(self, inherited=1, local=1): @@ -376,5 +392,17 @@ class PortalTypeDocumentationHelper(DocumentationHelper): uri_prefix = '%s.%s.' % (module, class_name) return map(lambda x: '%s%s' % (uri_prefix, x), method_id_list) + security.declareProtected( Permissions.AccessContentsInformation, 'getAccessorMethodUriList' ) + def getAccessorMethodUriList(self, inherited=1, local=1): + """ + Returns a list of URIs to accessor methods + """ + method_id_list = self.getAccessorMethodIdList(inherited=inherited) + portal_type = getPortalType(self.uri) + klass = self.getTempInstance(portal_type).__class__.__bases__[0] + class_name = klass.__name__ + module = klass.__module__ + uri_prefix = self.uri + return map(lambda x: '%s#%s' % (uri_prefix, x), method_id_list) InitializeClass(PortalTypeDocumentationHelper) diff --git a/product/ERP5Type/DocumentationHelper/PortalTypePropertySheetDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/PortalTypePropertySheetDocumentationHelper.py index 86544c7353c9af6f110cd57b37cefee262ce84be..f5974cd300ef05ceebf6ce9a7e47234729d8fcc7 100644 --- a/product/ERP5Type/DocumentationHelper/PortalTypePropertySheetDocumentationHelper.py +++ b/product/ERP5Type/DocumentationHelper/PortalTypePropertySheetDocumentationHelper.py @@ -54,14 +54,15 @@ class PortalTypePropertySheetDocumentationHelper(DocumentationHelper): """ Returns the id of the documentation helper """ - return self.getDocumentedObject().name.split("/")[-1] + name = getattr(self.getDocumentedObject(), "name", '') + return name.split("/")[-1] security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' ) def getTitle(self): """ Returns the title of the documentation helper """ - return self.getDocumentedObject().name + return getattr(self.etDocumentedObject(), "name", '') security.declareProtected( Permissions.AccessContentsInformation, 'getSourceCode' ) def getSourceCode(self): @@ -75,7 +76,7 @@ class PortalTypePropertySheetDocumentationHelper(DocumentationHelper): property_sheet_file.seek(0) source_code = property_sheet_file.read() portal_transforms = getattr(self, 'portal_transforms', None) - if portal_transforms is not None: + if portal_transforms is None: LOG('DCWorkflowScriptDocumentationHelper', INFO, 'Transformation Tool is not installed. No convertion of python script to html') return source_code diff --git a/product/ERP5Type/DocumentationHelper/PortalTypeRoleDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/PortalTypeRoleDocumentationHelper.py index f2488e822296ddc4bc603ab0d1a831f06d514260..3de0c52ab6a26be68835f78a34a32b85c24a83c6 100644 --- a/product/ERP5Type/DocumentationHelper/PortalTypeRoleDocumentationHelper.py +++ b/product/ERP5Type/DocumentationHelper/PortalTypeRoleDocumentationHelper.py @@ -31,7 +31,6 @@ from AccessControl import ClassSecurityInfo from Globals import InitializeClass from DocumentationHelper import DocumentationHelper from Products.ERP5Type import Permissions -from zLOG import LOG, INFO class PortalTypeRoleDocumentationHelper(DocumentationHelper): """ @@ -59,7 +58,7 @@ class PortalTypeRoleDocumentationHelper(DocumentationHelper): """ Returns the id of the documentation helper """ - return self.getDocumentedObject().__name__ + return getattr(self.getDocumentedObject(), "__name__", '') security.declareProtected( Permissions.AccessContentsInformation, 'getSectionList' ) def getSectionList(self): @@ -73,20 +72,20 @@ class PortalTypeRoleDocumentationHelper(DocumentationHelper): """ Returns the title of the documentation helper """ - return self.getDocumentedObject().title + return getattr(self.getDocumentedObject(), "title", '') security.declareProtected(Permissions.AccessContentsInformation, 'getCategoryList' ) def getCategoryList(self): """ Returns the list of categories for the role """ - return self.getDocumentedObject().category + return getattr(self.getDocumentedObject(), "category", '') security.declareProtected(Permissions.AccessContentsInformation, 'getBaseCategoryScript' ) def getBaseCategoryScript(self): """ Returns the base category script of the role """ - return self.getDocumentedObject().base_category_script + return getattr(self.getDocumentedObject(), "base_category_script", '') InitializeClass(PortalTypeRoleDocumentationHelper) diff --git a/product/ERP5Type/DocumentationHelper/ScriptPythonDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/ScriptPythonDocumentationHelper.py index d813071102c79d9014aecfe0692fa72ff1064a37..38a1c2f19b6e0f27a1d0517307419f39d887a5c5 100644 --- a/product/ERP5Type/DocumentationHelper/ScriptPythonDocumentationHelper.py +++ b/product/ERP5Type/DocumentationHelper/ScriptPythonDocumentationHelper.py @@ -54,14 +54,14 @@ class ScriptPythonDocumentationHelper(DocumentationHelper): """ Returns the id of the documentation helper """ - return self.getDocumentedObject().id + return getattr(self.getDocumentedObject(), "id", '') security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' ) def getTitle(self): """ Returns the title of the documentation helper """ - return self.getDocumentedObject().title + return getattr(self.getDocumentedObject(), "title", '') security.declareProtected( Permissions.AccessContentsInformation, 'getSourceCode' ) def getSourceCode(self): @@ -69,7 +69,7 @@ class ScriptPythonDocumentationHelper(DocumentationHelper): Returns the source code the script python """ from zLOG import LOG, INFO - source_code = self.getDocumentedObject()._body + source_code = getattr(self.getDocumentedObject(), "_body", '') portal_transforms = getattr(self, 'portal_transforms', None) if portal_transforms is None: LOG('DCWorkflowScriptDocumentationHelper', INFO, diff --git a/product/ERP5Type/DocumentationHelper/SkinFolderDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/SkinFolderDocumentationHelper.py index 483ef9198c00f962debbc8eb4093c2afa1a339f5..f346471063193d2a1b042090dffabab4906f09b9 100644 --- a/product/ERP5Type/DocumentationHelper/SkinFolderDocumentationHelper.py +++ b/product/ERP5Type/DocumentationHelper/SkinFolderDocumentationHelper.py @@ -42,6 +42,13 @@ class SkinFolderDocumentationHelper(DocumentationHelper): def __init__(self, uri): self.uri = uri + security.declareProtected( Permissions.AccessContentsInformation, 'getSectionList' ) + def getSectionList(self): + """ + Returns a list of documentation sections + """ + return [] + security.declareProtected(Permissions.AccessContentsInformation, 'getType' ) def getType(self): """ @@ -54,14 +61,14 @@ class SkinFolderDocumentationHelper(DocumentationHelper): """ Returns the id of the documentation helper """ - return self.getDocumentedObject().id + return getattr(self.getDocumentedObject(), "id", '') security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' ) def getTitle(self): """ Returns the title of the documentation helper """ - return self.getDocumentedObject().title + return getattr(self.getDocumentedObject(), "title", '') security.declareProtected(Permissions.AccessContentsInformation, 'getMetaTypeList' ) def getMetaTypeList(self): @@ -78,9 +85,11 @@ class SkinFolderDocumentationHelper(DocumentationHelper): Returns the list of sub-objects ids of the documentation helper """ file_list = [] - for file in self.getDocumentedObject().objectValues(): - if not meta_type or file.meta_type == meta_type: - file_list.append(file.id) + files = self.getDocumentedObject() + if files is not None: + for file in files.objectValues(): + if not meta_type or file.meta_type == meta_type: + file_list.append(file.id) return file_list security.declareProtected(Permissions.AccessContentsInformation, 'getFileItemList' ) @@ -89,9 +98,11 @@ class SkinFolderDocumentationHelper(DocumentationHelper): Returns the list of sub-objects items of the documentation helper """ file_list = [] - for file in self.getDocumentedObject().objectValues(): - if not meta_type or file.meta_type == meta_type: - file_list.append((file.id, file.title, file.meta_type)) + files = self.getDocumentedObject() + if files is not None: + for file in files.objectValues(): + if not meta_type or file.meta_type == meta_type: + file_list.append((file.id, file.title, file.meta_type)) return file_list InitializeClass(SkinFolderDocumentationHelper) diff --git a/product/ERP5Type/DocumentationHelper/SkinFolderItemDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/SkinFolderItemDocumentationHelper.py index 08038088e28380ac2143756e2b3fc05980f18929..aa2199d43597e3ec89beb973b74d504de048ed07 100644 --- a/product/ERP5Type/DocumentationHelper/SkinFolderItemDocumentationHelper.py +++ b/product/ERP5Type/DocumentationHelper/SkinFolderItemDocumentationHelper.py @@ -47,28 +47,28 @@ class SkinFolderItemDocumentationHelper(DocumentationHelper): """ Returns the type of the documentation helper """ - return self.getDocumentedObject().meta_type + return getattr(self.getDocumentedObject(), "meta_type", '') security.declareProtected(Permissions.AccessContentsInformation, 'getId' ) def getId(self): """ Returns the id of the documentation helper """ - return self.getDocumentedObject().id + return getattr(self.getDocumentedObject(), "id", '') security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' ) def getTitle(self): """ Returns the title of the documentation helper """ - return self.getDocumentedObject().title + return getattr(self.getDocumentedObject(), "title", '') security.declareProtected(Permissions.AccessContentsInformation, 'getContentType' ) def getContentType(self): """ Returns the title of the documentation helper """ - return self.getDocumentedObject().content_type + return getattr(self.getDocumentedObject(), "content_type", '') diff --git a/product/ERP5Type/DocumentationHelper/WorkflowMethodDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/WorkflowMethodDocumentationHelper.py index e9c20dcb81e8011276ff4b1f67ce0e564ff5bd7a..410dd2d4d70f061fb3bc94b5c007aa35d0daa008 100644 --- a/product/ERP5Type/DocumentationHelper/WorkflowMethodDocumentationHelper.py +++ b/product/ERP5Type/DocumentationHelper/WorkflowMethodDocumentationHelper.py @@ -45,7 +45,7 @@ class WorkflowMethodDocumentationHelper(DocumentationHelper): security.declareProtected(Permissions.AccessContentsInformation, 'getDescription') def getDescription(self): - return self.getDocumentedObject().__doc__ + return getattr(self.getDocumentedObject(), "__doc__", '') security.declareProtected(Permissions.AccessContentsInformation, 'getType' ) def getType(self): @@ -53,14 +53,13 @@ class WorkflowMethodDocumentationHelper(DocumentationHelper): Returns the type of the documentation helper """ return "Workflow Method" - #return self.getDocumentedObject().__module__ security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' ) def getTitle(self): """ Returns the title of the documentation helper """ - return self.getDocumentedObject().__name__ + return getattr(self.getDocumentedObject(), "__name__", '') security.declareProtected( Permissions.AccessContentsInformation, 'getSectionList' ) def getSectionList(self): diff --git a/product/ERP5Type/DocumentationHelper/ZSQLMethodDocumentationHelper.py b/product/ERP5Type/DocumentationHelper/ZSQLMethodDocumentationHelper.py index b53ee2d886205d4de2d81ad4a07c90da85703e27..9ac7a7c541adccebba248234cd3dab507ccc4302 100644 --- a/product/ERP5Type/DocumentationHelper/ZSQLMethodDocumentationHelper.py +++ b/product/ERP5Type/DocumentationHelper/ZSQLMethodDocumentationHelper.py @@ -54,14 +54,14 @@ class ZSQLMethodDocumentationHelper(DocumentationHelper): """ Returns the id of the documentation helper """ - return self.getDocumentedObject().id + return getattr(self.getDocumentedObject(), "id", '') security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' ) def getTitle(self): """ Returns the title of the documentation helper """ - return self.getDocumentedObject().title + return getattr(self.getDocumentedObject(), "title", '') security.declareProtected(Permissions.AccessContentsInformation, 'getSource' ) def getSource(self): @@ -69,7 +69,7 @@ class ZSQLMethodDocumentationHelper(DocumentationHelper): Returns the source code of the documentation helper """ from zLOG import LOG, INFO - source_code = self.getDocumentedObject().src + source_code = getattr(self.getDocumentedObject(), "src", '') portal_transforms = getattr(self, 'portal_transforms', None) if portal_transforms is None: LOG('DCWorkflowScriptDocumentationHelper', INFO, @@ -85,34 +85,34 @@ class ZSQLMethodDocumentationHelper(DocumentationHelper): """ Returns the title of the documentation helper """ - return self.getDocumentedObject().connection_id + return getattr(self.getDocumentedObject(), "connection_id", '') security.declareProtected(Permissions.AccessContentsInformation, 'getArgumentList' ) def getArgumentList(self): """ Returns the arguments of the documentation helper """ - return self.getDocumentedObject().arguments_src + return getattr(self.getDocumentedObject(), "arguments_src", []) security.declareProtected(Permissions.AccessContentsInformation, 'getClassName' ) def getClassName(self): """ Returns the class name of the documentation helper """ - return self.getDocumentedObject().class_name_ + return getattr(self.getDocumentedObject(), "class_name_", '') security.declareProtected(Permissions.AccessContentsInformation, 'getClassFile' ) def getClassFile(self): """ Returns the class file of the documentation helper """ - return self.getDocumentedObject().class_file_ + return getattr(self.getDocumentedObject(), "class_file_", '') security.declareProtected(Permissions.AccessContentsInformation, 'getMaxRows' ) def getMaxRows(self): """ Returns the of the documentation helper """ - return self.getDocumentedObject().max_rows_ + return getattr(self.getDocumentedObject(), "max_rows_", '') InitializeClass(ZSQLMethodDocumentationHelper)