[Erp5-report] r24644 - /erp5/trunk/products/ERP5Type/DocumentationHelper/

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Nov 20 10:11:35 CET 2008


Author: seb
Date: Thu Nov 20 10:11:33 2008
New Revision: 24644

URL: http://svn.erp5.org?rev=24644&view=rev
Log:
- Merged ScriptPythonDocumentationHelper and DCWorkflowScriptDocumentationHelper
- Merged CatalogMethodDocumentationHelper and ZSQLMethodDocumentationHelper
- Improve the rendering of parameters of python scripts

Modified:
    erp5/trunk/products/ERP5Type/DocumentationHelper/AccessorMethodDocumentationHelper.py
    erp5/trunk/products/ERP5Type/DocumentationHelper/CatalogMethodDocumentationHelper.py
    erp5/trunk/products/ERP5Type/DocumentationHelper/DCWorkflowScriptDocumentationHelper.py
    erp5/trunk/products/ERP5Type/DocumentationHelper/ScriptPythonDocumentationHelper.py

Modified: erp5/trunk/products/ERP5Type/DocumentationHelper/AccessorMethodDocumentationHelper.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/DocumentationHelper/AccessorMethodDocumentationHelper.py?rev=24644&r1=24643&r2=24644&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/DocumentationHelper/AccessorMethodDocumentationHelper.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/DocumentationHelper/AccessorMethodDocumentationHelper.py [utf8] Thu Nov 20 10:11:33 2008
@@ -46,6 +46,11 @@
       fc.append('*args')
     elif fc_var_names[i] == 'kw':
       fc.append('**kw')
+    elif fc_var_names[i].startswith('_') or \
+        fc_var_names[i].startswith('Products'):
+      # In case of python scripts, we have many things
+      # that we do not want to display
+      break
     else:
       fc.append(fc_var_names[i])
   fd = obj.func_defaults

Modified: erp5/trunk/products/ERP5Type/DocumentationHelper/CatalogMethodDocumentationHelper.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/DocumentationHelper/CatalogMethodDocumentationHelper.py?rev=24644&r1=24643&r2=24644&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/DocumentationHelper/CatalogMethodDocumentationHelper.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/DocumentationHelper/CatalogMethodDocumentationHelper.py [utf8] Thu Nov 20 10:11:33 2008
@@ -29,10 +29,10 @@
 from Acquisition import Implicit
 from AccessControl import ClassSecurityInfo
 from Globals import InitializeClass
-from DocumentationHelper import DocumentationHelper
+from ZSQLMethodDocumentationHelper import ZSQLMethodDocumentationHelper
 from Products.ERP5Type import Permissions
 
-class CatalogMethodDocumentationHelper(DocumentationHelper):
+class CatalogMethodDocumentationHelper(ZSQLMethodDocumentationHelper):
   """
     Provides documentation about a catalog method
   """
@@ -62,28 +62,6 @@
     Returns the title of the documentation helper
     """
     return getattr(self.getDocumentedObject(), 'title', '')
-
-  security.declareProtected(Permissions.AccessContentsInformation, 'getSource' )
-  def getSource(self):
-    """
-    Returns the source code the catalog method
-    """
-    from zLOG import LOG, INFO
-    source_code = getattr(self.getDocumentedObject(), 'src', '')
-    portal_transforms = getattr(self, 'portal_transforms', 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
-    src_mimetype='text/plain'
-    mime_type = 'text/html'
-    source_html = portal_transforms.convertTo(mime_type, source_code, mimetype = src_mimetype)
-    return source_html.getData()
 
   security.declareProtected(Permissions.AccessContentsInformation, 'getConnectionId' )
   def getConnectionId(self):

Modified: erp5/trunk/products/ERP5Type/DocumentationHelper/DCWorkflowScriptDocumentationHelper.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/DocumentationHelper/DCWorkflowScriptDocumentationHelper.py?rev=24644&r1=24643&r2=24644&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/DocumentationHelper/DCWorkflowScriptDocumentationHelper.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/DocumentationHelper/DCWorkflowScriptDocumentationHelper.py [utf8] Thu Nov 20 10:11:33 2008
@@ -29,41 +29,15 @@
 from Acquisition import Implicit
 from AccessControl import ClassSecurityInfo
 from Globals import InitializeClass
-from DocumentationHelper import DocumentationHelper
+from ScriptPythonDocumentationHelper import ScriptPythonDocumentationHelper
 from Products.ERP5Type import Permissions
-from AccessorMethodDocumentationHelper import getDefinitionString
 
-class DCWorkflowScriptDocumentationHelper(DocumentationHelper):
+class DCWorkflowScriptDocumentationHelper(ScriptPythonDocumentationHelper):
   """
     Provides documentation about a workflow script
   """
   security = ClassSecurityInfo()
   security.declareObjectProtected(Permissions.AccessContentsInformation)
-
-  def __init__(self, uri):
-    self.uri = uri
-
-  security.declareProtected(Permissions.AccessContentsInformation, 'getType' )
-  def getType(self):
-    """
-    Returns the type of the documentation helper
-    """
-    return "Workflow Script"
-
-  security.declareProtected(Permissions.AccessContentsInformation, 'getId' )
-  def getId(self):
-    """
-    Returns the id of the documentation helper
-    """
-    return getattr(self.getDocumentedObject(), "__name__", "")
-
-
-  security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' )
-  def getTitle(self):
-    """
-    Returns the title of the documentation helper
-    """
-    return getattr(self.getDocumentedObject(), "title", "")
 
   security.declareProtected(Permissions.AccessContentsInformation, 'getSectionList')
   def getSectionList(self):
@@ -72,39 +46,4 @@
     """
     return []
 
-  security.declareProtected( Permissions.AccessContentsInformation, 'getDefinition' )
-  def getDefinition(self):
-    """
-    Returns the definition of the script with the name of the script and arguments
-    """
-    return getDefinitionString(self.getDocumentedObject())
-
-  security.declareProtected( Permissions.AccessContentsInformation, 'getSourceCode' )
-  def getSourceCode(self):
-    """
-    Returns the source code the workflow script
-    """
-    from zLOG import LOG, INFO
-    source_code = ""
-    wf_script = self.getDocumentedObject()
-    source_code = wf_script.document_src()
-    portal_transforms = getattr(self, 'portal_transforms', None)
-    if portal_transforms is not None:
-      REQUEST = getattr(self, 'REQUEST', None)
-      if REQUEST is not None:
-        if REQUEST.get('portal_skin', 'View' ) != 'View':
-          doc_string = source_code.split('"""')
-          if len(doc_string)>1 and not doc_string[0]:
-            return doc_string[1]
-          else:
-            return ""
-    else:
-      LOG('DCWorkflowScriptDocumentationHelper', INFO,
-          'Transformation Tool is not installed. No convertion of python script to html')
-      return source_code
-    src_mimetype='text/x-python'
-    mime_type = 'text/html'
-    source_html = portal_transforms.convertTo(mime_type, source_code, mimetype = src_mimetype)
-    return source_html.getData()
-
 InitializeClass(DCWorkflowScriptDocumentationHelper)

Modified: erp5/trunk/products/ERP5Type/DocumentationHelper/ScriptPythonDocumentationHelper.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/DocumentationHelper/ScriptPythonDocumentationHelper.py?rev=24644&r1=24643&r2=24644&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/DocumentationHelper/ScriptPythonDocumentationHelper.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/DocumentationHelper/ScriptPythonDocumentationHelper.py [utf8] Thu Nov 20 10:11:33 2008
@@ -31,6 +31,7 @@
 from Globals import InitializeClass
 from DocumentationHelper import DocumentationHelper
 from Products.ERP5Type import Permissions
+from AccessorMethodDocumentationHelper import getDefinitionString
 
 class ScriptPythonDocumentationHelper(DocumentationHelper):
   """
@@ -89,4 +90,11 @@
     source_html = portal_transforms.convertTo(mime_type, source_code, mimetype = src_mimetype)
     return source_html.getData()
 
+  security.declareProtected( Permissions.AccessContentsInformation, 'getDefinition' )
+  def getDefinition(self):
+    """
+    Returns the definition of the script with the name of the script and arguments
+    """
+    return getDefinitionString(self.getDocumentedObject())
+
 InitializeClass(ScriptPythonDocumentationHelper)




More information about the Erp5-report mailing list