Commit a7f94b0c authored by Mayoro Diagne's avatar Mayoro Diagne

- Avoid displaying None when description is not define in ClassMethodDocumentationHelper

- When portal_skin if different to view mode, do not use portal_transform for displaying python source code 


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23132 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9ca57367
......@@ -42,7 +42,7 @@ class ClassMethodDocumentationHelper(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):
......@@ -56,7 +56,7 @@ class ClassMethodDocumentationHelper(DocumentationHelper):
"""
Returns the type of the documentation helper
"""
return self.getDocumentedObject().__name__
return getattr(self.getDocumentedObject(), "__doc__", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getSectionList')
def getSectionList(self):
......
......@@ -72,7 +72,12 @@ class PageTemplateDocumentationHelper(DocumentationHelper):
from zLOG import LOG, INFO
source_code = getattr(self.getDocumentedObject(), "_text", '')
portal_transforms = getattr(self, 'portal_transforms', None)
if portal_transforms is None:
if portal_transforms is not None:
REQUEST = getattr(self, 'REQUEST', None)
if REQUEST is not None:
if REQUEST.get('portal_skin', 'View' ) != 'View':
return source_code
else:
LOG('DCWorkflowScriptDocumentationHelper', INFO,
'Transformation Tool is not installed. No convertion of python script to html')
return source_code
......
......@@ -76,7 +76,12 @@ 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 None:
if portal_transforms is not None:
REQUEST = getattr(self, 'REQUEST', None)
if REQUEST is not None:
if REQUEST.get('portal_skin', 'View' ) != 'View':
return source_code
else:
LOG('DCWorkflowScriptDocumentationHelper', INFO,
'Transformation Tool is not installed. No convertion of python script to html')
return source_code
......@@ -85,4 +90,6 @@ class PortalTypePropertySheetDocumentationHelper(DocumentationHelper):
source_html = portal_transforms.convertTo(mime_type, source_code, mimetype = src_mimetype)
return source_html.getData()
InitializeClass(PortalTypePropertySheetDocumentationHelper)
......@@ -71,7 +71,12 @@ class ScriptPythonDocumentationHelper(DocumentationHelper):
from zLOG import LOG, INFO
source_code = getattr(self.getDocumentedObject(), "_body", '')
portal_transforms = getattr(self, 'portal_transforms', None)
if portal_transforms is None:
if portal_transforms is not None:
REQUEST = getattr(self, 'REQUEST', None)
if REQUEST is not None:
if REQUEST.get('portal_skin', 'View' ) != 'View':
return source_code
else:
LOG('DCWorkflowScriptDocumentationHelper', INFO,
'Transformation Tool is not installed. No convertion of python script to html')
return source_code
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment