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): ...@@ -42,7 +42,7 @@ class ClassMethodDocumentationHelper(DocumentationHelper):
security.declareProtected(Permissions.AccessContentsInformation, 'getDescription') security.declareProtected(Permissions.AccessContentsInformation, 'getDescription')
def getDescription(self): def getDescription(self):
return self.getDocumentedObject().__doc__ return getattr(self.getDocumentedObject(), "__doc__", '')
security.declareProtected( Permissions.AccessContentsInformation, 'getType' ) security.declareProtected( Permissions.AccessContentsInformation, 'getType' )
def getType(self): def getType(self):
...@@ -56,7 +56,7 @@ class ClassMethodDocumentationHelper(DocumentationHelper): ...@@ -56,7 +56,7 @@ class ClassMethodDocumentationHelper(DocumentationHelper):
""" """
Returns the type of the documentation helper Returns the type of the documentation helper
""" """
return self.getDocumentedObject().__name__ return getattr(self.getDocumentedObject(), "__doc__", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getSectionList') security.declareProtected(Permissions.AccessContentsInformation, 'getSectionList')
def getSectionList(self): def getSectionList(self):
......
...@@ -72,7 +72,12 @@ class PageTemplateDocumentationHelper(DocumentationHelper): ...@@ -72,7 +72,12 @@ class PageTemplateDocumentationHelper(DocumentationHelper):
from zLOG import LOG, INFO from zLOG import LOG, INFO
source_code = getattr(self.getDocumentedObject(), "_text", '') source_code = getattr(self.getDocumentedObject(), "_text", '')
portal_transforms = getattr(self, 'portal_transforms', None) 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, LOG('DCWorkflowScriptDocumentationHelper', INFO,
'Transformation Tool is not installed. No convertion of python script to html') 'Transformation Tool is not installed. No convertion of python script to html')
return source_code return source_code
......
...@@ -76,13 +76,20 @@ class PortalTypePropertySheetDocumentationHelper(DocumentationHelper): ...@@ -76,13 +76,20 @@ class PortalTypePropertySheetDocumentationHelper(DocumentationHelper):
property_sheet_file.seek(0) property_sheet_file.seek(0)
source_code = property_sheet_file.read() source_code = property_sheet_file.read()
portal_transforms = getattr(self, 'portal_transforms', None) 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, LOG('DCWorkflowScriptDocumentationHelper', INFO,
'Transformation Tool is not installed. No convertion of python script to html') 'Transformation Tool is not installed. No convertion of python script to html')
return source_code return source_code
src_mimetype='text/x-python' src_mimetype='text/x-python'
mime_type = 'text/html' mime_type = 'text/html'
source_html = portal_transforms.convertTo(mime_type, source_code, mimetype = src_mimetype) source_html = portal_transforms.convertTo(mime_type, source_code, mimetype = src_mimetype)
return source_html.getData() return source_html.getData()
InitializeClass(PortalTypePropertySheetDocumentationHelper) InitializeClass(PortalTypePropertySheetDocumentationHelper)
...@@ -71,7 +71,12 @@ class ScriptPythonDocumentationHelper(DocumentationHelper): ...@@ -71,7 +71,12 @@ class ScriptPythonDocumentationHelper(DocumentationHelper):
from zLOG import LOG, INFO from zLOG import LOG, INFO
source_code = getattr(self.getDocumentedObject(), "_body", '') source_code = getattr(self.getDocumentedObject(), "_body", '')
portal_transforms = getattr(self, 'portal_transforms', None) 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, LOG('DCWorkflowScriptDocumentationHelper', INFO,
'Transformation Tool is not installed. No convertion of python script to html') 'Transformation Tool is not installed. No convertion of python script to html')
return source_code 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