Commit 73af12f0 authored by Julien Muchembled's avatar Julien Muchembled

* Clean up (refactoring, code style, deletion of useless code, ...).

* Bugfixes (display of signature of callable objects, display of portal type actions, ...).
* Define list of sections in an attribute, instead of hardcoding it.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25600 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 122c9993
...@@ -26,48 +26,11 @@ ...@@ -26,48 +26,11 @@
# #
############################################################################## ##############################################################################
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass from Globals import InitializeClass
from DocumentationHelper import DocumentationHelper from DocumentationHelper import DocumentationHelper, getCallableSignatureString
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
#return the definition string of an object representing a workflow method or a class method or an accessor
def getDefinitionString(obj=None):
if obj is None:
return ""
func_code = getattr(obj, "func_code", None)
if func_code is None:
return ""
fc_var_names = getattr(func_code, "co_varnames", [])
fc = []
for i in range(len(fc_var_names)):
if fc_var_names[i] == 'args':
fc.append('*args')
elif fc_var_names[i] == 'kw':
fc.append('**kw')
else:
fc.append(fc_var_names[i])
fd = obj.func_defaults
acc_def = obj.__name__ + ' ('
if fd == None:
acc_def += ', '.join(fc)
else:
for x in range(len(fc)):
if (len(fc)-(x+1)<len(fd)):
if (x == len(fc)-1):
acc_def += " "+str(fc[x])+"='"+str(fd[x-len(fd)])+"'"
else:
acc_def += " "+str(fc[x])+"='"+str(fd[x-len(fd)])+"',"
else:
if (x == len(fc)-1):
acc_def += " "+str(fc[x])
else:
acc_def += " "+str(fc[x])+","
acc_def += ")"
return acc_def
class AccessorMethodDocumentationHelper(DocumentationHelper): class AccessorMethodDocumentationHelper(DocumentationHelper):
""" """
Provides documentation about an accessor Provides documentation about an accessor
...@@ -75,54 +38,55 @@ class AccessorMethodDocumentationHelper(DocumentationHelper): ...@@ -75,54 +38,55 @@ class AccessorMethodDocumentationHelper(DocumentationHelper):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
def __init__(self, uri): security.declareProtected(Permissions.AccessContentsInformation, 'getTitle')
self.uri = uri def getTitle(self):
"""
"""
obj = self.getDocumentedObject()
if obj is not None:
return obj.__name__
security.declareProtected(Permissions.AccessContentsInformation, 'getDescription') security.declareProtected(Permissions.AccessContentsInformation, 'getDescription')
def getDescription(self): def getDescription(self):
return getattr(self.getDocumentedObject(), "__doc__", "") """
"""
obj = self.getDocumentedObject()
if obj is not None:
return obj.__doc__
security.declareProtected( Permissions.AccessContentsInformation, 'getType' ) security.declareProtected(Permissions.AccessContentsInformation, 'getType')
def getType(self): def getType(self):
""" """
Returns the type of the documentation helper Returns the type of the documentation helper
""" """
return "Accessor Method" return "Accessor Method"
security.declareProtected( Permissions.AccessContentsInformation, 'getTitle' ) security.declareProtected(Permissions.AccessContentsInformation, 'getArgCount')
def getTitle(self):
"""
Returns the title of the documentation helper
"""
return getattr(self.getDocumentedObject(), "__name__", "")
security.declareProtected(Permissions.AccessContentsInformation, 'getSectionList')
def getSectionList(self):
"""
Returns a list of documentation sections for accessors
"""
return []
security.declareProtected( Permissions.AccessContentsInformation, 'getArgCount' )
def getArgCount(self): def getArgCount(self):
""" """
Returns the number of args of the accessor Returns the number of args of the accessor
""" """
return self.getDocumentedObject().func_code.co_argcount obj = self.getDocumentedObject()
if obj is not None:
return obj.func_code.co_argcount
security.declareProtected( Permissions.AccessContentsInformation, 'getVarNames' ) security.declareProtected(Permissions.AccessContentsInformation, 'getVarNames')
def getVarNames(self): def getVarNames(self):
""" """
Returns the list of args of the accessor Returns the list of args of the accessor
""" """
return self.getDocumentedObject().func_code.co_varnames obj = self.getDocumentedObject()
if obj is not None:
return obj.func_code.co_varnames
security.declareProtected( Permissions.AccessContentsInformation, 'getDefinition' ) security.declareProtected(Permissions.AccessContentsInformation, 'getDefinition')
def getDefinition(self): def getDefinition(self):
""" """
Returns the definition of the accessor_method with the name and arguments Returns the definition of the accessor_method with the name and arguments
""" """
return getDefinitionString(self.getDocumentedObject()) obj = self.getDocumentedObject()
if obj is not None:
return getCallableSignatureString(obj)
InitializeClass(AccessorMethodDocumentationHelper) InitializeClass(AccessorMethodDocumentationHelper)
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
# #
############################################################################## ##############################################################################
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass from Globals import InitializeClass
from DocumentationHelper import DocumentationHelper from DocumentationHelper import DocumentationHelper
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
# #
############################################################################## ##############################################################################
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass from Globals import InitializeClass
from ZSQLMethodDocumentationHelper import ZSQLMethodDocumentationHelper from ZSQLMethodDocumentationHelper import ZSQLMethodDocumentationHelper
...@@ -39,38 +38,21 @@ class CatalogMethodDocumentationHelper(ZSQLMethodDocumentationHelper): ...@@ -39,38 +38,21 @@ class CatalogMethodDocumentationHelper(ZSQLMethodDocumentationHelper):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
def __init__(self, uri): security.declareProtected(Permissions.AccessContentsInformation, 'getType')
self.uri = uri
security.declareProtected(Permissions.AccessContentsInformation, 'getType' )
def getType(self): def getType(self):
""" """
Returns the type of the documentation helper Returns the type of the documentation helper
""" """
return "Catalog Method" return "Catalog Method"
security.declareProtected(Permissions.AccessContentsInformation, 'getId' ) security.declareProtected(Permissions.AccessContentsInformation, 'getConnectionId')
def getId(self):
"""
Returns the id of the documentation helper
"""
return getattr(self.getDocumentedObject(), 'id', '')
security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' )
def getTitle(self):
"""
Returns the title of the documentation helper
"""
return getattr(self.getDocumentedObject(), 'title', '')
security.declareProtected(Permissions.AccessContentsInformation, 'getConnectionId' )
def getConnectionId(self): def getConnectionId(self):
""" """
Returns the title of the documentation helper Returns the title of the documentation helper
""" """
return getattr(self.getDocumentedObject(), 'connection_id', '') return getattr(self.getDocumentedObject(), 'connection_id', '')
security.declareProtected(Permissions.AccessContentsInformation, 'getArgumentList' ) security.declareProtected(Permissions.AccessContentsInformation, 'getArgumentList')
def getArgumentList(self): def getArgumentList(self):
""" """
Returns the arguments of the documentation helper Returns the arguments of the documentation helper
...@@ -82,7 +64,7 @@ class CatalogMethodDocumentationHelper(ZSQLMethodDocumentationHelper): ...@@ -82,7 +64,7 @@ class CatalogMethodDocumentationHelper(ZSQLMethodDocumentationHelper):
keys = getattr(arg, '_keys', []) keys = getattr(arg, '_keys', [])
return keys return keys
security.declareProtected(Permissions.AccessContentsInformation, 'getCatalog' ) security.declareProtected(Permissions.AccessContentsInformation, 'getCatalog')
def getCatalog(self): def getCatalog(self):
""" """
Returns the catalog name of the documentation helper Returns the catalog name of the documentation helper
......
##############################################################################
#
# Copyright (c) 2007-2008 Nexedi SA and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo
from Globals import InitializeClass
from DocumentationHelper import DocumentationHelper
from Products.ERP5Type import Permissions
class ClassDocumentationHelper(DocumentationHelper):
"""
"""
...@@ -26,12 +26,10 @@ ...@@ -26,12 +26,10 @@
# #
############################################################################## ##############################################################################
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass from Globals import InitializeClass
from DocumentationHelper import DocumentationHelper from DocumentationHelper import DocumentationHelper, getCallableSignatureString
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from AccessorMethodDocumentationHelper import getDefinitionString
class ClassMethodDocumentationHelper(DocumentationHelper): class ClassMethodDocumentationHelper(DocumentationHelper):
""" """
...@@ -40,37 +38,32 @@ class ClassMethodDocumentationHelper(DocumentationHelper): ...@@ -40,37 +38,32 @@ class ClassMethodDocumentationHelper(DocumentationHelper):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
security.declareProtected(Permissions.AccessContentsInformation, 'getDescription') security.declareProtected(Permissions.AccessContentsInformation, 'getTitle')
def getDescription(self): def getTitle(self):
return getattr(self.getDocumentedObject(), "__doc__", '')
security.declareProtected( Permissions.AccessContentsInformation, 'getType' )
def getType(self):
""" """
Returns the type of the documentation helper Returns the id of the documentation helper
""" """
return "Class Method" return self.getDocumentedObject().__name__
security.declareProtected( Permissions.AccessContentsInformation, 'getTitle' ) security.declareProtected(Permissions.AccessContentsInformation, 'getDescription')
def getTitle(self): def getDescription(self):
""" """
Returns the type of the documentation helper
""" """
return getattr(self.getDocumentedObject(), "__doc__", '') return self.getDocumentedObject().__doc__
security.declareProtected(Permissions.AccessContentsInformation, 'getSectionList') security.declareProtected(Permissions.AccessContentsInformation, 'getType')
def getSectionList(self): def getType(self):
""" """
Returns a list of documentation sections for class method Returns the type of the documentation helper
""" """
return [] return "Class Method"
security.declareProtected( Permissions.AccessContentsInformation, 'getDefinition' ) security.declareProtected(Permissions.AccessContentsInformation, 'getDefinition')
def getDefinition(self): def getDefinition(self):
""" """
Returns the definition of the class_method with the name and arguments Returns the definition of the class_method with the name and arguments
""" """
return getDefinitionString(self.getDocumentedObject()) return getCallableSignatureString(self.getDocumentedObject())
InitializeClass(ClassMethodDocumentationHelper) InitializeClass(ClassMethodDocumentationHelper)
##############################################################################
#
# Copyright (c) 2007-2008 Nexedi SA and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from Acquisition import Implicit
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):
"""
Provides documentation about a workflow permission
"""
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
def __init__(self, uri):
self.uri = uri
security.declareProtected(Permissions.AccessContentsInformation, 'getDescription')
def getDescription(self):
#return getattr(self.getDocumentedObject(), "description", "")
return ""
security.declareProtected(Permissions.AccessContentsInformation, 'getType' )
def getType(self):
"""
Returns the type of the documentation helper
"""
return "Workflow Permission"
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):
"""
Returns a list of documentation sections for workflow permissions
"""
return []
InitializeClass(DCWorkflowPermissionDocumentationHelper)
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
# #
############################################################################## ##############################################################################
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass from Globals import InitializeClass
from ScriptPythonDocumentationHelper import ScriptPythonDocumentationHelper from ScriptPythonDocumentationHelper import ScriptPythonDocumentationHelper
...@@ -36,14 +35,5 @@ class DCWorkflowScriptDocumentationHelper(ScriptPythonDocumentationHelper): ...@@ -36,14 +35,5 @@ class DCWorkflowScriptDocumentationHelper(ScriptPythonDocumentationHelper):
""" """
Provides documentation about a workflow script Provides documentation about a workflow script
""" """
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
security.declareProtected(Permissions.AccessContentsInformation, 'getSectionList')
def getSectionList(self):
"""
Returns a list of documentation sections for workflow scripts
"""
return []
InitializeClass(DCWorkflowScriptDocumentationHelper) InitializeClass(DCWorkflowScriptDocumentationHelper)
...@@ -26,39 +26,11 @@ ...@@ -26,39 +26,11 @@
# #
############################################################################## ##############################################################################
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass from Globals import InitializeClass
from DocumentationHelper import DocumentationHelper from DocumentationHelper import DocumentationHelper
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
def getPermissionsOfRole(state=None, role=''):
"""
Returns list of permissions for a given role with AVMC format above
A = Access contents information
V = View
M = Modify Portal Content
C = Add Portal Content
"""
permissions = ""
if state != None:
if hasattr(state, '__dict__'):
if 'permission_roles' in state.__dict__.keys():
if 'View' in state.__dict__['permission_roles'].keys():
if role in state.__dict__['permission_roles']['View']:
permissions += "V"
if 'Access contents information' in state.__dict__['permission_roles'].keys():
if role in state.__dict__['permission_roles']['Access contents information']:
permissions += "A"
if 'Modify portal content' in state.__dict__['permission_roles'].keys():
if role in state.__dict__['permission_roles']['Modify portal content']:
permissions += "M"
if 'Add portal content' in state.__dict__['permission_roles'].keys():
if role in state.__dict__['permission_roles']['Add portal content']:
permissions += "C"
return permissions
class DCWorkflowStateDocumentationHelper(DocumentationHelper): class DCWorkflowStateDocumentationHelper(DocumentationHelper):
""" """
Provides documentation about a workflow state Provides documentation about a workflow state
...@@ -66,82 +38,75 @@ class DCWorkflowStateDocumentationHelper(DocumentationHelper): ...@@ -66,82 +38,75 @@ class DCWorkflowStateDocumentationHelper(DocumentationHelper):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
def __init__(self, uri): security.declareProtected(Permissions.AccessContentsInformation, 'getType')
self.uri = uri
security.declareProtected(Permissions.AccessContentsInformation, 'getDescription')
def getDescription(self):
return self.getDocumentedObject().__dict__["description"]
security.declareProtected(Permissions.AccessContentsInformation, 'getType' )
def getType(self): def getType(self):
""" """
Returns the type of the documentation helper Returns the type of the documentation helper
""" """
return "Workflow State" return "Workflow State"
security.declareProtected(Permissions.AccessContentsInformation, 'getId' ) security.declareProtected(Permissions.AccessContentsInformation, 'getTransitionList')
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", "")
def getSectionList(self):
"""
Returns a list of documentation sections
"""
return []
security.declareProtected( Permissions.AccessContentsInformation, 'getTransitionList' )
def getTransitionList(self): def getTransitionList(self):
""" """
Returns list of possible transitions from this state Returns list of possible transitions from this state
""" """
return getattr(self.getDocumentedObject(), "transitions", []) return self.getDocumentedObject().transitions
security.declareProtected( Permissions.AccessContentsInformation, 'getPermissionsOfRoleOwner' ) def getPermissionsOfRole(self, role):
"""
Returns list of permissions for a given role with AVMC format above
A = Access contents information
V = View
M = Modify Portal Content
C = Add Portal Content
"""
permissions = ""
permission_roles = self.getDocumentedObject().permission_roles
if permission_roles:
if role in state.permission_roles.get('Access contents information', ()):
permissions += "A"
if role in state.permission_roles.get('View', ()):
permissions += "V"
if role in state.permission_roles.get('Modify portal content', ()):
permissions += "M"
if role in state.permission_roles.get('Add portal content', ()):
permissions += "C"
return permissions
security.declareProtected(Permissions.AccessContentsInformation, 'getPermissionsOfRoleOwner')
def getPermissionsOfRoleOwner(self): def getPermissionsOfRoleOwner(self):
""" """
""" """
return getPermissionsOfRole(self.getDocumentedObject(),'Owner') return self.getPermissionsOfRole('Owner')
security.declareProtected( Permissions.AccessContentsInformation, 'getPermissionsOfRoleAssignor' ) security.declareProtected(Permissions.AccessContentsInformation, 'getPermissionsOfRoleAssignor')
def getPermissionsOfRoleAssignor(self): def getPermissionsOfRoleAssignor(self):
""" """
""" """
return getPermissionsOfRole(self.getDocumentedObject(),'Assignor') return self.getPermissionsOfRole('Assignor')
security.declareProtected( Permissions.AccessContentsInformation, 'getPermissionsOfRoleAssignee' ) security.declareProtected(Permissions.AccessContentsInformation, 'getPermissionsOfRoleAssignee')
def getPermissionsOfRoleAssignee(self): def getPermissionsOfRoleAssignee(self):
""" """
""" """
return getPermissionsOfRole(self.getDocumentedObject(),'Assignee') return self.getPermissionsOfRole('Assignee')
security.declareProtected( Permissions.AccessContentsInformation, 'getPermissionsOfRoleAssociate' ) security.declareProtected(Permissions.AccessContentsInformation, 'getPermissionsOfRoleAssociate')
def getPermissionsOfRoleAssociate(self): def getPermissionsOfRoleAssociate(self):
""" """
""" """
return getPermissionsOfRole(self.getDocumentedObject(),'Associate') return self.getPermissionsOfRole('Associate')
security.declareProtected( Permissions.AccessContentsInformation, 'getPermissionsOfRoleAuthor' ) security.declareProtected(Permissions.AccessContentsInformation, 'getPermissionsOfRoleAuthor')
def getPermissionsOfRoleAuthor(self): def getPermissionsOfRoleAuthor(self):
""" """
""" """
return getPermissionsOfRole(self.getDocumentedObject(),'Author') return self.getPermissionsOfRole('Author')
security.declareProtected( Permissions.AccessContentsInformation, 'getPermissionsOfRoleAuditor' ) security.declareProtected(Permissions.AccessContentsInformation, 'getPermissionsOfRoleAuditor')
def getPermissionsOfRoleAuditor(self): def getPermissionsOfRoleAuditor(self):
""" """
""" """
return getPermissionsOfRole(self.getDocumentedObject(),'Auditor') return self.getPermissionsOfRole('Auditor')
InitializeClass(DCWorkflowStateDocumentationHelper) InitializeClass(DCWorkflowStateDocumentationHelper)
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
# #
############################################################################## ##############################################################################
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass from Globals import InitializeClass
from DocumentationHelper import DocumentationHelper from DocumentationHelper import DocumentationHelper
...@@ -39,50 +38,21 @@ class DCWorkflowTransitionDocumentationHelper(DocumentationHelper): ...@@ -39,50 +38,21 @@ class DCWorkflowTransitionDocumentationHelper(DocumentationHelper):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
def __init__(self, uri): security.declareProtected(Permissions.AccessContentsInformation, 'getType')
self.uri = uri
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): def getType(self):
""" """
Returns the type of the documentation helper Returns the type of the documentation helper
""" """
return "Workflow Transition" return "Workflow Transition"
security.declareProtected(Permissions.AccessContentsInformation, 'getId' ) security.declareProtected(Permissions.AccessContentsInformation, 'getNewStateId')
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):
"""
Returns a list of documentation sections
"""
return []
security.declareProtected(Permissions.AccessContentsInformation, 'getNewStateId' )
def getNewStateId(self): def getNewStateId(self):
""" """
Returns the id of the new state for de workflow transition Returns the id of the new state for de workflow transition
""" """
return getattr(self.getDocumentedObject(), "new_state_id", '') return getattr(self.getDocumentedObject(), "new_state_id", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getTriggerType' ) security.declareProtected(Permissions.AccessContentsInformation, 'getTriggerType')
def getTriggerType(self): def getTriggerType(self):
""" """
Returns the trigger type for de workflow transition Returns the trigger type for de workflow transition
...@@ -91,28 +61,28 @@ class DCWorkflowTransitionDocumentationHelper(DocumentationHelper): ...@@ -91,28 +61,28 @@ class DCWorkflowTransitionDocumentationHelper(DocumentationHelper):
trigger_type_id = getattr(self.getDocumentedObject(), "trigger_type", '') trigger_type_id = getattr(self.getDocumentedObject(), "trigger_type", '')
return trigger_type_list[trigger_type_id] return trigger_type_list[trigger_type_id]
security.declareProtected(Permissions.AccessContentsInformation, 'getScriptName' ) security.declareProtected(Permissions.AccessContentsInformation, 'getScriptName')
def getScriptName(self): def getScriptName(self):
""" """
Returns the name of the script for de workflow transition Returns the name of the script for de workflow transition
""" """
return getattr(self.getDocumentedObject(), "script_name", '') return getattr(self.getDocumentedObject(), "script_name", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getAfterScriptName' ) security.declareProtected(Permissions.AccessContentsInformation, 'getAfterScriptName')
def getAfterScriptName(self): def getAfterScriptName(self):
""" """
Returns the name of the script for de workflow transition Returns the name of the script for de workflow transition
""" """
return getattr(self.getDocumentedObject(), "after_script_name", '') return getattr(self.getDocumentedObject(), "after_script_name", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getAvailableStateIds' ) security.declareProtected(Permissions.AccessContentsInformation, 'getAvailableStateIds')
def getAvailableStateIds(self): def getAvailableStateIds(self):
""" """
Returns available states in the workflow Returns available states in the workflow
""" """
return self.getDocumentedObject().getAvailableStateIds() return self.getDocumentedObject().getAvailableStateIds()
security.declareProtected(Permissions.AccessContentsInformation, 'getGuardRoles' ) security.declareProtected(Permissions.AccessContentsInformation, 'getGuardRoles')
def getGuardRoles(self): def getGuardRoles(self):
""" """
Returns roles to pass this transition Returns roles to pass this transition
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
# #
############################################################################## ##############################################################################
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass from Globals import InitializeClass
from DocumentationHelper import DocumentationHelper from DocumentationHelper import DocumentationHelper
...@@ -39,42 +38,14 @@ class DCWorkflowVariableDocumentationHelper(DocumentationHelper): ...@@ -39,42 +38,14 @@ class DCWorkflowVariableDocumentationHelper(DocumentationHelper):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
def __init__(self, uri): security.declareProtected(Permissions.AccessContentsInformation, 'getType')
self.uri = uri
security.declareProtected(Permissions.AccessContentsInformation, 'getDescription')
def getDescription(self):
return getattr(self.getDocumentedObject(), "description", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getType' )
def getType(self): def getType(self):
""" """
Returns the type of the documentation helper Returns the type of the documentation helper
""" """
return "Workflow Variable" return "Workflow Variable"
security.declareProtected(Permissions.AccessContentsInformation, 'getId' ) security.declareProtected(Permissions.AccessContentsInformation, 'getDefaultExpression')
def getId(self):
"""
Returns the id of the documentation helper
"""
return getattr(self.getDocumentedObject(), "__name__", '')
security.declareProtected( Permissions.AccessContentsInformation, 'getSectionList' )
def getSectionList(self):
"""
Returns a list of documentation sections
"""
return []
security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' )
def getTitle(self):
"""
Returns the title of the documentation helper
"""
return getattr(self.getDocumentedObject(), "title", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getDefaultExpression' )
def getDefaultExpression(self): def getDefaultExpression(self):
""" """
Returns the Default Expression of the documentation helper Returns the Default Expression of the documentation helper
...@@ -84,7 +55,7 @@ class DCWorkflowVariableDocumentationHelper(DocumentationHelper): ...@@ -84,7 +55,7 @@ class DCWorkflowVariableDocumentationHelper(DocumentationHelper):
default_expr = self.getDocumentedObject().default_expr.text default_expr = self.getDocumentedObject().default_expr.text
return default_expr return default_expr
security.declareProtected(Permissions.AccessContentsInformation, 'getForCatalog' ) security.declareProtected(Permissions.AccessContentsInformation, 'getForCatalog')
def getForCatalog(self): def getForCatalog(self):
""" """
Returns 1 if variable is available in the catalog Returns 1 if variable is available in the catalog
...@@ -98,7 +69,7 @@ class DCWorkflowVariableDocumentationHelper(DocumentationHelper): ...@@ -98,7 +69,7 @@ class DCWorkflowVariableDocumentationHelper(DocumentationHelper):
else: else:
return 'No' return 'No'
security.declareProtected(Permissions.AccessContentsInformation, 'getUpdateAlways' ) security.declareProtected(Permissions.AccessContentsInformation, 'getUpdateAlways')
def getUpdateAlways(self): def getUpdateAlways(self):
""" """
Returns 1 if variable is available in the history Returns 1 if variable is available in the history
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
# #
############################################################################## ##############################################################################
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass from Globals import InitializeClass
from DocumentationHelper import DocumentationHelper from DocumentationHelper import DocumentationHelper
...@@ -39,46 +38,22 @@ class DCWorkflowWorklistDocumentationHelper(DocumentationHelper): ...@@ -39,46 +38,22 @@ class DCWorkflowWorklistDocumentationHelper(DocumentationHelper):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
def __init__(self, uri): security.declareProtected(Permissions.AccessContentsInformation, 'getType')
self.uri = uri
security.declareProtected(Permissions.AccessContentsInformation, 'getDescription')
def getDescription(self):
return getattr(self.getDocumentedObject(), "description", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getType' )
def getType(self): def getType(self):
""" """
Returns the type of the documentation helper Returns the type of the documentation helper
""" """
return "Workflow Worklist" return "Workflow Worklist"
security.declareProtected(Permissions.AccessContentsInformation, 'getId' ) security.declareProtected(Permissions.AccessContentsInformation, 'getTitle')
def getId(self):
"""
Returns the id of the documentation helper
"""
return getattr(self.getDocumentedObject(), "__name__", '')
security.declareProtected( Permissions.AccessContentsInformation, 'getSectionList' )
def getSectionList(self):
"""
Returns a list of documentation sections
"""
return []
security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' )
def getTitle(self): def getTitle(self):
""" """
Returns the title of the documentation helper Returns the title of the documentation helper
""" """
if self.getDocumentedObject().title == "": return DocumentationHelper.getTitle(self) \
return self.getDocumentedObject().actbox_name or self.getDocumentedObject().actbox_name
else:
return self.getDocumentedObject().title
security.declareProtected(Permissions.AccessContentsInformation, 'getGuardRoles' ) security.declareProtected(Permissions.AccessContentsInformation, 'getGuardRoles')
def getGuardRoles(self): def getGuardRoles(self):
""" """
Returns roles to pass this worklist Returns roles to pass this worklist
...@@ -91,7 +66,7 @@ class DCWorkflowWorklistDocumentationHelper(DocumentationHelper): ...@@ -91,7 +66,7 @@ class DCWorkflowWorklistDocumentationHelper(DocumentationHelper):
role_list = self.getDocumentedObject().guard.__dict__['roles'] role_list = self.getDocumentedObject().guard.__dict__['roles']
return ', '.join(role for role in role_list) return ', '.join(role for role in role_list)
security.declareProtected(Permissions.AccessContentsInformation, 'getVarMatches' ) security.declareProtected(Permissions.AccessContentsInformation, 'getVarMatches')
def getVarMatches(self): def getVarMatches(self):
""" """
Returns variables and values to match worklist Returns variables and values to match worklist
......
...@@ -26,13 +26,16 @@ ...@@ -26,13 +26,16 @@
# #
############################################################################## ##############################################################################
from Acquisition import Implicit from Acquisition import Implicit, aq_base
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass from Globals import InitializeClass
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from App.config import getConfiguration from App.config import getConfiguration
import os import os
import random import random
from Products.ERP5Type.Base import Base
from Products.ERP5Type.Utils import convertToUpperCase
from DocumentationSection import DocumentationSection
class TempObjectLibrary(object): class TempObjectLibrary(object):
...@@ -70,6 +73,27 @@ class TempObjectLibrary(object): ...@@ -70,6 +73,27 @@ class TempObjectLibrary(object):
self.portal_type_dict[portal_type] = temp_object self.portal_type_dict[portal_type] = temp_object
return temp_object return temp_object
def getCallableSignatureString(func):
"""Return the definition string of a callable object."""
from compiler.consts import CO_VARARGS, CO_VARKEYWORDS
args = list(func.func_code.co_varnames)
defaults = func.func_defaults or ()
i = func.func_code.co_argcount - len(defaults)
for default in defaults:
args[i] += '=' + repr(default)
i += 1
# XXX ERP5 code does not set co_flags attribute :(
flags = getattr(func.func_code, 'co_flags', None)
for flag, name, prefix in ((CO_VARARGS, 'args', '*'),
(CO_VARKEYWORDS, 'kw', '**')):
if flags is not None and flags & flag \
or flags is None and i < len(args) and args[i] == name:
args[i] = prefix + args[i]
i += 1
return '%s(%s)' % (func.__name__, ', '.join(args[:i]))
class DocumentationHelper(Implicit): class DocumentationHelper(Implicit):
""" """
Example URIs Example URIs
...@@ -83,16 +107,25 @@ class DocumentationHelper(Implicit): ...@@ -83,16 +107,25 @@ class DocumentationHelper(Implicit):
Products.ERP5Type.Document.Person.notify Products.ERP5Type.Document.Person.notify
Products.ERP5Type.Document.Person.isRAD Products.ERP5Type.Document.Person.isRAD
portal_types/Person portal_types/Person
portal_types/Person/actions#view portal_types/Person?_actions#view
""" """
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
_section_list = ()
# Methods to override # Methods to override
def __init__(self, uri): def __init__(self, uri):
self.uri = uri self.uri = uri
security.declareProtected( Permissions.AccessContentsInformation, 'getTempInstance' ) security.declareProtected(Permissions.AccessContentsInformation, 'getId')
def getId(self):
"""
Returns the id of the documentation helper
"""
return self.getDocumentedObject().id
security.declareProtected(Permissions.AccessContentsInformation, 'getTempInstance')
def getTempInstance(self, portal_type): def getTempInstance(self, portal_type):
""" """
Returns a temporary instance of the given portal_type Returns a temporary instance of the given portal_type
...@@ -175,12 +208,13 @@ class DocumentationHelper(Implicit): ...@@ -175,12 +208,13 @@ class DocumentationHelper(Implicit):
#documented_object = imp.load_module(fp, pathname, description) #documented_object = imp.load_module(fp, pathname, description)
return documented_object return documented_object
security.declareProtected(Permissions.AccessContentsInformation, 'getTitle')
def getTitle(self): def getTitle(self):
""" """
Returns the title of the documentation helper Returns the title of the documentation helper
(ex. class name) (ex. class name)
""" """
raise NotImplemented return getattr(aq_base(self.getDocumentedObject()), 'title', '')
def getType(self): def getType(self):
""" """
...@@ -189,12 +223,28 @@ class DocumentationHelper(Implicit): ...@@ -189,12 +223,28 @@ class DocumentationHelper(Implicit):
""" """
raise NotImplemented raise NotImplemented
security.declareProtected(Permissions.AccessContentsInformation, 'getDescription')
def getDescription(self):
"""
Returns the title of the documentation helper
"""
return getattr(aq_base(self.getDocumentedObject()), 'description', '')
def getSectionUriList(self, id, **kw):
return getattr(self, 'get%sUriList' % convertToUpperCase(id))()
security.declareProtected(Permissions.AccessContentsInformation, 'getSectionList') security.declareProtected(Permissions.AccessContentsInformation, 'getSectionList')
def getSectionList(self): def getSectionList(self):
""" """
Returns a list of documentation sections Returns a list of documentation sections
""" """
return [] section_list = []
for section in self._section_list:
uri_list = self.getSectionUriList(**section)
if uri_list:
section_list.append(DocumentationSection(uri_list=uri_list, **section)
.__of__(self))
return section_list
security.declareProtected(Permissions.AccessContentsInformation, 'getURI') security.declareProtected(Permissions.AccessContentsInformation, 'getURI')
def getURI(self): def getURI(self):
...@@ -212,7 +262,7 @@ class DocumentationHelper(Implicit): ...@@ -212,7 +262,7 @@ class DocumentationHelper(Implicit):
""" """
return self.__class__.__name__ return self.__class__.__name__
security.declareProtected(Permissions.AccessContentsInformation, 'view') security.declareProtected(Permissions.View, 'view')
def view(self): def view(self):
""" """
Renders the documentation with a standard form Renders the documentation with a standard form
...@@ -220,8 +270,17 @@ class DocumentationHelper(Implicit): ...@@ -220,8 +270,17 @@ class DocumentationHelper(Implicit):
""" """
return getattr(self, '%s_view' % self.getClassName())() return getattr(self, '%s_view' % self.getClassName())()
security.declareProtected(Permissions.AccessContentsInformation, '__call__') security.declareProtected(Permissions.View, '__call__')
def __call__(self): def __call__(self):
return self.view() return self.view()
def _getPropertyHolder(self):
property_holder = None
key = self.getPortalType(), self.getDocumentedObject().__class__
if not(Base.aq_portal_type.has_key(key)):
self.getDocumentedObject().initializePortalTypeDynamicProperties()
property_holder = Base.aq_portal_type[key]
return property_holder
InitializeClass(DocumentationHelper) InitializeClass(DocumentationHelper)
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
# #
############################################################################## ##############################################################################
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass from Globals import InitializeClass
from DocumentationHelper import DocumentationHelper from DocumentationHelper import DocumentationHelper
...@@ -39,42 +38,18 @@ class ERP5FormDocumentationHelper(DocumentationHelper): ...@@ -39,42 +38,18 @@ class ERP5FormDocumentationHelper(DocumentationHelper):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
def __init__(self, uri): security.declareProtected(Permissions.AccessContentsInformation, 'getType')
self.uri = uri
security.declareProtected(Permissions.AccessContentsInformation, 'getType' )
def getType(self): def getType(self):
""" """
Returns the type of the documentation helper Returns the type of the documentation helper
""" """
return "ERP5 Form" return "ERP5 Form"
security.declareProtected(Permissions.AccessContentsInformation, 'getId' ) security.declareProtected(Permissions.AccessContentsInformation, 'getEncoding')
def getId(self):
"""
Returns the id of the documentation helper
"""
return getattr(self.getDocumentedObject(), "id", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' )
def getTitle(self):
"""
Returns the title of the documentation helper
"""
return getattr(self.getDocumentedObject(), "title", '')
security.declareProtected( Permissions.AccessContentsInformation, 'getEncoding' )
def getEncoding(self): def getEncoding(self):
""" """
Returns the encoding of the ERP5 Form Returns the encoding of the ERP5 Form
""" """
return getattr(self.getDocumentedObject(), "encoding", '') return getattr(self.getDocumentedObject(), "encoding", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getDescription' )
def getDescription(self):
"""
Returns the description of the documentation helper
"""
return getattr(self.getDocumentedObject(), "description", '')
InitializeClass(ERP5FormDocumentationHelper) InitializeClass(ERP5FormDocumentationHelper)
...@@ -27,11 +27,9 @@ ...@@ -27,11 +27,9 @@
# #
############################################################################## ##############################################################################
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass from Globals import InitializeClass
from DocumentationHelper import DocumentationHelper from DocumentationHelper import DocumentationHelper
from DocumentationSection import DocumentationSection
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
class ERP5SiteDocumentationHelper(DocumentationHelper): class ERP5SiteDocumentationHelper(DocumentationHelper):
...@@ -39,77 +37,44 @@ class ERP5SiteDocumentationHelper(DocumentationHelper): ...@@ -39,77 +37,44 @@ class ERP5SiteDocumentationHelper(DocumentationHelper):
Provides access to all documentation information Provides access to all documentation information
of an ERP5 Site. of an ERP5 Site.
""" """
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
# API Implementation _section_list = (
security.declareProtected( Permissions.AccessContentsInformation, 'getTitle' ) dict(
def getTitle(self): id='business_template',
""" title='Business Template',
Returns the title of the documentation helper class_name='BusinessTemplateDocumentationHelper',
""" ),
return getattr(self.getDocumentedObject(), "title", '') )
security.declareProtected( Permissions.AccessContentsInformation, 'getType' ) security.declareProtected(Permissions.AccessContentsInformation, 'getType')
def getType(self): def getType(self):
""" """
Returns the type of the documentation helper Returns the type of the documentation helper
""" """
return "ERP5 Site" return "ERP5 Site"
security.declareProtected( Permissions.AccessContentsInformation, 'getSectionList' ) def getBusinessTemplateValueList(self):
def getSectionList(self): bt_list = getattr(self, 'REQUEST', {}).get("business_template_list")
""" return (bt for bt in self.getPortalObject().portal_templates.objectValues()
Returns a list of documentation sections if bt_list is None or bt.getTitle() in bt_list)
"""
return map(lambda x: x.__of__(self), [
DocumentationSection(
id='business_template',
title='Business Template',
class_name='BusinessTemplateDocumentationHelper',
uri_list=self.getBusinessTemplateUriList(),
),
])
# Specific methods
security.declareProtected( Permissions.AccessContentsInformation, 'getDescription' )
def getDescription(self):
"""
Returns the description of the documentation helper
"""
return getattr(self.getDocumentedObject(), "description", '')
security.declareProtected( Permissions.AccessContentsInformation, 'getBusinessTemplateItemList' ) security.declareProtected(Permissions.AccessContentsInformation, 'getBusinessTemplateItemList')
def getBusinessTemplateItemList(self): def getBusinessTemplateItemList(self):
""" """
""" """
REQUEST = getattr(self, 'REQUEST', None)
business_template_list = [bt.getTitle() for bt in self.getDocumentedObject().portal_templates.objectValues()]
if REQUEST is not None and "business_template_list" in REQUEST.keys():
business_template_list = REQUEST.get("business_template_list", [])
return [(bt.getId(), return [(bt.getId(),
getattr(bt, "title", ''), getattr(bt, "title", ''),
getattr(bt, "description", ''), getattr(bt, "description", ''),
getattr(bt, "version", ''), getattr(bt, "version", ''),
getattr(bt, "revision", '')) getattr(bt, "revision", ''))
for bt in self.getDocumentedObject().portal_templates.objectValues() for bt in self.getBusinessTemplateValueList()]
if bt.getInstallationState() == 'installed' and bt.getTitle() in business_template_list]
security.declareProtected( Permissions.AccessContentsInformation, 'getBusinessTemplateURIList' )
def getBusinessTemplateURIList(self):
"""
"""
bt_list = self.getBusinessTemplateItemList()
base_uri = '/'+self.uri.split('/')[1]
return map(lambda x: ('%s/portal_templates/%s' % (base_uri, x[0]),x[1], x[2], x[3], x[4]), bt_list)
security.declareProtected( Permissions.AccessContentsInformation, 'getBusinessTemplateUriList' ) security.declareProtected(Permissions.AccessContentsInformation, 'getBusinessTemplateUriList')
def getBusinessTemplateUriList(self): def getBusinessTemplateUriList(self):
""" """
""" """
bt_list = self.getBusinessTemplateItemList() return [bt.getPath() for bt in self.getBusinessTemplateValueList()]
base_uri = '/'+self.uri.split('/')[1]
return map(lambda x: ('%s/portal_templates/%s' % (base_uri, x[0])), bt_list)
InitializeClass(ERP5SiteDocumentationHelper) InitializeClass(ERP5SiteDocumentationHelper)
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
# #
############################################################################## ##############################################################################
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass from Globals import InitializeClass
from DocumentationHelper import DocumentationHelper from DocumentationHelper import DocumentationHelper
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
# #
############################################################################## ##############################################################################
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass from Globals import InitializeClass
from DocumentationHelper import DocumentationHelper from DocumentationHelper import DocumentationHelper
...@@ -39,40 +38,14 @@ class PageTemplateDocumentationHelper(DocumentationHelper): ...@@ -39,40 +38,14 @@ class PageTemplateDocumentationHelper(DocumentationHelper):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
def __init__(self, uri): security.declareProtected(Permissions.AccessContentsInformation, 'getType')
self.uri = uri
security.declareProtected(Permissions.AccessContentsInformation, 'getType' )
def getType(self): def getType(self):
""" """
Returns the type of the documentation helper Returns the type of the documentation helper
""" """
return "Page Template" return "Page Template"
security.declareProtected(Permissions.AccessContentsInformation, 'getId' ) security.declareProtected(Permissions.AccessContentsInformation, 'getSourceCode')
def getId(self):
"""
Returns the id of the documentation helper
"""
return getattr(self.getDocumentedObject(), "id", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' )
def getTitle(self):
"""
Returns the title of the documentation helper
"""
return getattr(self.getDocumentedObject(), "title", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getDescription' )
def getDescription(self):
"""
Returns the description of the documentation helper
"""
return getattr(self.getDocumentedObject(), "description", '')
security.declareProtected( Permissions.AccessContentsInformation, 'getSourceCode' )
def getSourceCode(self): def getSourceCode(self):
""" """
Returns the source code the script python Returns the source code the script python
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
# #
############################################################################## ##############################################################################
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass from Globals import InitializeClass
from DocumentationHelper import DocumentationHelper from DocumentationHelper import DocumentationHelper
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
# #
############################################################################## ##############################################################################
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass from Globals import InitializeClass
from DocumentationHelper import DocumentationHelper from DocumentationHelper import DocumentationHelper
...@@ -39,45 +38,14 @@ class PortalTypeActionDocumentationHelper(DocumentationHelper): ...@@ -39,45 +38,14 @@ class PortalTypeActionDocumentationHelper(DocumentationHelper):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
def __init__(self, uri): security.declareProtected(Permissions.AccessContentsInformation, 'getType')
self.uri = uri
security.declareProtected(Permissions.AccessContentsInformation, 'getType' )
def getType(self): def getType(self):
""" """
Returns the type of the documentation helper Returns the type of the documentation helper
""" """
return "Portal Type Action" return "Portal Type Action"
security.declareProtected(Permissions.AccessContentsInformation, 'getId' ) security.declareProtected(Permissions.AccessContentsInformation, 'getPermissions')
def getId(self):
"""
Returns the id of the documentation helper
"""
return getattr(self.getDocumentedObject(), "__name__", '')
security.declareProtected( Permissions.AccessContentsInformation, 'getSectionList' )
def getSectionList(self):
"""
Returns a list of documentation sections
"""
return []
security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' )
def getTitle(self):
"""
Returns the title of the documentation helper
"""
return getattr(self.getDocumentedObject(), "title", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getDescription' )
def getDescription(self):
"""
Returns the title of the documentation helper
"""
return getattr(self.getDocumentedObject(), "description", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getPermissions' )
def getPermissions(self): def getPermissions(self):
""" """
Returns the permissions of the documentation helper Returns the permissions of the documentation helper
...@@ -85,7 +53,7 @@ class PortalTypeActionDocumentationHelper(DocumentationHelper): ...@@ -85,7 +53,7 @@ class PortalTypeActionDocumentationHelper(DocumentationHelper):
permissions = getattr(self.getDocumentedObject(), "permissions", []) permissions = getattr(self.getDocumentedObject(), "permissions", [])
return ', '.join(x for x in permissions) return ', '.join(x for x in permissions)
security.declareProtected(Permissions.AccessContentsInformation, 'getVisible' ) security.declareProtected(Permissions.AccessContentsInformation, 'getVisible')
def getVisible(self): def getVisible(self):
""" """
Returns the visibility of the documentation helper Returns the visibility of the documentation helper
...@@ -93,7 +61,7 @@ class PortalTypeActionDocumentationHelper(DocumentationHelper): ...@@ -93,7 +61,7 @@ class PortalTypeActionDocumentationHelper(DocumentationHelper):
TITLE =['No', 'Yes'] TITLE =['No', 'Yes']
return TITLE[getattr(self.getDocumentedObject(), "visible", 0)] return TITLE[getattr(self.getDocumentedObject(), "visible", 0)]
security.declareProtected(Permissions.AccessContentsInformation, 'getCategory' ) security.declareProtected(Permissions.AccessContentsInformation, 'getCategory')
def getCategory(self): def getCategory(self):
""" """
Returns the category of the documentation helper Returns the category of the documentation helper
......
...@@ -26,12 +26,13 @@ ...@@ -26,12 +26,13 @@
# #
############################################################################## ##############################################################################
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass from Globals import InitializeClass
from DocumentationHelper import DocumentationHelper from DocumentationHelper import DocumentationHelper
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
# XXX Use lxml instead.
try: try:
from libxml2 import parseDoc, parserError from libxml2 import parseDoc, parserError
import_succeed = 1 import_succeed = 1
...@@ -47,32 +48,28 @@ class PortalTypePropertySheetDocumentationHelper(DocumentationHelper): ...@@ -47,32 +48,28 @@ class PortalTypePropertySheetDocumentationHelper(DocumentationHelper):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
def __init__(self, uri): security.declareProtected(Permissions.AccessContentsInformation, 'getType')
self.uri = uri
security.declareProtected(Permissions.AccessContentsInformation, 'getType' )
def getType(self): def getType(self):
""" """
Returns the type of the documentation helper Returns the type of the documentation helper
""" """
return "Property Sheet" return "Property Sheet"
security.declareProtected(Permissions.AccessContentsInformation, 'getId' ) security.declareProtected(Permissions.AccessContentsInformation, 'getId')
def getId(self): def getId(self):
""" """
Returns the id of the documentation helper Returns the id of the documentation helper
""" """
name = getattr(self.getDocumentedObject(), "name", '') return self.uri.rsplit("/",1)[-1][:-3]
return name.split("/")[-1]
security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' ) security.declareProtected(Permissions.AccessContentsInformation, 'getTitle')
def getTitle(self): def getTitle(self):
""" """
Returns the title of the documentation helper Returns the title of the documentation helper
""" """
return getattr(self.getDocumentedObject(), "name", '') return self.getDocumentedObject().name
security.declareProtected( Permissions.AccessContentsInformation, 'getSourceCode' ) security.declareProtected(Permissions.AccessContentsInformation, 'getSourceCode')
def getSourceCode(self): def getSourceCode(self):
""" """
Returns the source code the property sheet Returns the source code the property sheet
...@@ -132,5 +129,4 @@ class PortalTypePropertySheetDocumentationHelper(DocumentationHelper): ...@@ -132,5 +129,4 @@ class PortalTypePropertySheetDocumentationHelper(DocumentationHelper):
return source_code return source_code
InitializeClass(PortalTypePropertySheetDocumentationHelper) InitializeClass(PortalTypePropertySheetDocumentationHelper)
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
# #
############################################################################## ##############################################################################
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass from Globals import InitializeClass
from DocumentationHelper import DocumentationHelper from DocumentationHelper import DocumentationHelper
...@@ -39,53 +38,21 @@ class PortalTypeRoleDocumentationHelper(DocumentationHelper): ...@@ -39,53 +38,21 @@ class PortalTypeRoleDocumentationHelper(DocumentationHelper):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
def __init__(self, uri): security.declareProtected(Permissions.AccessContentsInformation, 'getType')
self.uri = uri
security.declareProtected(Permissions.AccessContentsInformation, 'getDescription')
def getDescription(self):
documented_object = self.getDocumentedObject()
if documented_object is not None:
return documented_object.Description()
else:
return ''
security.declareProtected(Permissions.AccessContentsInformation, 'getType' )
def getType(self): def getType(self):
""" """
Returns the type of the documentation helper Returns the type of the documentation helper
""" """
return "Portal Type Role" return "Portal Type Role"
security.declareProtected(Permissions.AccessContentsInformation, 'getId' ) security.declareProtected(Permissions.AccessContentsInformation, 'getCategoryList')
def getId(self):
"""
Returns the id of the documentation helper
"""
return getattr(self.getDocumentedObject(), "__name__", '')
security.declareProtected( Permissions.AccessContentsInformation, 'getSectionList' )
def getSectionList(self):
"""
Returns a list of documentation sections
"""
return []
security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' )
def getTitle(self):
"""
Returns the title of the documentation helper
"""
return getattr(self.getDocumentedObject(), "title", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getCategoryList' )
def getCategoryList(self): def getCategoryList(self):
""" """
Returns the list of categories for the role Returns the list of categories for the role
""" """
return getattr(self.getDocumentedObject(), "category", '') return getattr(self.getDocumentedObject(), "category", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getBaseCategoryScript' ) security.declareProtected(Permissions.AccessContentsInformation, 'getBaseCategoryScript')
def getBaseCategoryScript(self): def getBaseCategoryScript(self):
""" """
Returns the base category script of the role Returns the base category script of the role
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
# #
############################################################################## ##############################################################################
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass from Globals import InitializeClass
from DocumentationHelper import DocumentationHelper from DocumentationHelper import DocumentationHelper
......
...@@ -26,12 +26,10 @@ ...@@ -26,12 +26,10 @@
# #
############################################################################## ##############################################################################
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass from Globals import InitializeClass
from DocumentationHelper import DocumentationHelper from DocumentationHelper import DocumentationHelper
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from AccessorMethodDocumentationHelper import getDefinitionString
class ScriptPythonDocumentationHelper(DocumentationHelper): class ScriptPythonDocumentationHelper(DocumentationHelper):
""" """
...@@ -40,38 +38,21 @@ class ScriptPythonDocumentationHelper(DocumentationHelper): ...@@ -40,38 +38,21 @@ class ScriptPythonDocumentationHelper(DocumentationHelper):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
def __init__(self, uri): security.declareProtected(Permissions.AccessContentsInformation, 'getType')
self.uri = uri
security.declareProtected(Permissions.AccessContentsInformation, 'getType' )
def getType(self): def getType(self):
""" """
Returns the type of the documentation helper Returns the type of the documentation helper
""" """
return "Script Python" return "Script Python"
security.declareProtected(Permissions.AccessContentsInformation, 'getId' ) security.declareProtected(Permissions.AccessContentsInformation, 'getParams')
def getId(self):
"""
Returns the id of the documentation helper
"""
return getattr(self.getDocumentedObject(), "id", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' )
def getTitle(self):
"""
Returns the title of the documentation helper
"""
return getattr(self.getDocumentedObject(), "title", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getParams' )
def getParams(self): def getParams(self):
""" """
Returns the title of the documentation helper Returns the title of the documentation helper
""" """
return getattr(self.getDocumentedObject(), "_params", '') return getattr(self.getDocumentedObject(), "_params", '')
security.declareProtected( Permissions.AccessContentsInformation, 'getSourceCode' ) security.declareProtected(Permissions.AccessContentsInformation, 'getSourceCode')
def getSourceCode(self): def getSourceCode(self):
""" """
Returns the source code the script python Returns the source code the script python
...@@ -97,7 +78,7 @@ class ScriptPythonDocumentationHelper(DocumentationHelper): ...@@ -97,7 +78,7 @@ class ScriptPythonDocumentationHelper(DocumentationHelper):
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()
security.declareProtected( Permissions.AccessContentsInformation, 'getDefinition' ) security.declareProtected(Permissions.AccessContentsInformation, 'getDefinition')
def getDefinition(self): def getDefinition(self):
""" """
Returns the definition of the script with the name of the script and arguments Returns the definition of the script with the name of the script and arguments
......
...@@ -26,11 +26,10 @@ ...@@ -26,11 +26,10 @@
# #
############################################################################## ##############################################################################
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Acquisition import aq_base
from Globals import InitializeClass from Globals import InitializeClass
from DocumentationHelper import DocumentationHelper from DocumentationHelper import DocumentationHelper
from DocumentationSection import DocumentationSection
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
class SkinFolderDocumentationHelper(DocumentationHelper): class SkinFolderDocumentationHelper(DocumentationHelper):
...@@ -40,118 +39,75 @@ class SkinFolderDocumentationHelper(DocumentationHelper): ...@@ -40,118 +39,75 @@ class SkinFolderDocumentationHelper(DocumentationHelper):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
def __init__(self, uri): _section_list = (
self.uri = uri dict(
id='erp5_form',
title='ERP5 Form',
class_name='ERP5FormDocumentationHelper',
),
dict(
id='zsql_method',
title='Z SQL Method',
class_name='ZSQLMethodDocumentationHelper',
),
dict(
id='page_template',
title='Page Template',
class_name='PageTemplateDocumentationHelper',
),
dict(
id='script_python',
title='Script (Python)',
class_name='ScriptPythonDocumentationHelper',
),
)
security.declareProtected( Permissions.AccessContentsInformation, 'getSectionList' ) security.declareProtected(Permissions.AccessContentsInformation, 'getType')
def getSectionList(self):
"""
Returns a list of documentation sections
"""
section_list = []
if self.getFileURIList(meta_type='ERP5 Form') != []:
section_list.append(
DocumentationSection(
id='erp5_form',
title='ERP5 Form',
class_name='ERP5FormDocumentationHelper',
uri_list=self.getFileURIList(meta_type='ERP5 Form'),
)
)
if self.getFileURIList(meta_type='Z SQL Method') != []:
section_list.append(
DocumentationSection(
id='zsql_method',
title='Z SQL Method',
class_name='ZSQLMethodDocumentationHelper',
uri_list=self.getFileURIList(meta_type='Z SQL Method'),
)
)
if self.getFileURIList(meta_type='Page Template') != []:
section_list.append(
DocumentationSection(
id='page_template',
title='Page Template',
class_name='PageTemplateDocumentationHelper',
uri_list=self.getFileURIList(meta_type='Page Template'),
)
)
if self.getFileURIList(meta_type='Script (Python)') != []:
section_list.append(
DocumentationSection(
id='script_python',
title='Script (Python)',
class_name='ScriptPythonDocumentationHelper',
uri_list=self.getFileURIList(meta_type='Script (Python)'),
)
)
return map(lambda x: x.__of__(self), section_list)
security.declareProtected(Permissions.AccessContentsInformation, 'getType' )
def getType(self): def getType(self):
""" """
Returns the type of the documentation helper Returns the type of the documentation helper
""" """
return "Skin Folder" return "Skin Folder"
security.declareProtected(Permissions.AccessContentsInformation, 'getId' ) security.declareProtected(Permissions.AccessContentsInformation, 'getMetaTypeList')
def getId(self):
"""
Returns the id of the documentation helper
"""
return getattr(self.getDocumentedObject(), "id", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' )
def getTitle(self):
"""
Returns the title of the documentation helper
"""
return getattr(self.getDocumentedObject(), "title", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getMetaTypeList' )
def getMetaTypeList(self): def getMetaTypeList(self):
meta_type_dict = {} return sorted(set(obj.meta_type
for file in self.getDocumentedObject().objectValues(): for obj in self.getDocumentedObject().objectValues()))
meta_type_dict[file.meta_type] = None
type_list = meta_type_dict.keys()
type_list.sort()
return type_list
security.declareProtected(Permissions.AccessContentsInformation, 'getFileIdList' ) def getFileValueList(self, meta_type=None):
return (obj for obj in self.getDocumentedObject().objectValues()
if meta_type in (None, obj.meta_type))
security.declareProtected(Permissions.AccessContentsInformation, 'getFileIdList')
def getFileIdList(self, meta_type=None): def getFileIdList(self, meta_type=None):
""" """
Returns the list of sub-objects ids of the documentation helper Returns the list of sub-objects ids of the documentation helper
""" """
file_list = [] return [obj.id for obj in self.getFileValueList(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)
return file_list
security.declareProtected(Permissions.AccessContentsInformation, 'getFileItemList' ) security.declareProtected(Permissions.AccessContentsInformation, 'getFileItemList')
def getFileItemList(self, meta_type=None): def getFileItemList(self, meta_type=None):
""" """
Returns the list of sub-objects items of the documentation helper Returns the list of sub-objects items of the documentation helper
""" """
file_list = [] obj_list = []
files = self.getDocumentedObject() for obj in self.getFileValueList(meta_type):
if files is not None: obj = aq_base(obj)
for file in files.objectValues(): obj_list.append((obj.id,
if not meta_type or file.meta_type == meta_type: getattr(obj, "title", ""),
file_list.append((file.id, getattr(obj, "description", ""),
getattr(file, "title", ""), getattr(obj, "meta_type", "")))
getattr(file, "description", ""), return obj_list
getattr(file, "meta_type", "")))
return file_list security.declareProtected(Permissions.AccessContentsInformation, 'getFileUriList')
security.declareProtected( Permissions.AccessContentsInformation, 'getFileURIList' ) def getFileUriList(self, meta_type=None):
def getFileURIList(self, meta_type=None):
""" """
""" """
file_list = self.getFileIdList(meta_type) prefix = self.uri + '/'
base_uri = '/%s/portal_skins/%s' % (self.getPortalObject().id, self.getDocumentedObject().id) return [prefix + obj.id for obj in self.getFileValueList(meta_type)]
return map(lambda x: ('%s/%s' % (base_uri, x)), file_list)
def getSectionUriList(self, title, **kw):
return self.getFileUriList(title)
InitializeClass(SkinFolderDocumentationHelper) InitializeClass(SkinFolderDocumentationHelper)
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
# #
############################################################################## ##############################################################################
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass from Globals import InitializeClass
from DocumentationHelper import DocumentationHelper from DocumentationHelper import DocumentationHelper
...@@ -39,31 +38,14 @@ class SkinFolderItemDocumentationHelper(DocumentationHelper): ...@@ -39,31 +38,14 @@ class SkinFolderItemDocumentationHelper(DocumentationHelper):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
def __init__(self, uri): security.declareProtected(Permissions.AccessContentsInformation, 'getType')
self.uri = uri
security.declareProtected(Permissions.AccessContentsInformation, 'getType' )
def getType(self): def getType(self):
""" """
Returns the type of the documentation helper Returns the type of the documentation helper
""" """
return getattr(self.getDocumentedObject(), "meta_type", '') return getattr(self.getDocumentedObject(), "meta_type", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getId' ) security.declareProtected(Permissions.AccessContentsInformation, 'getContentType')
def getId(self):
"""
Returns the id of the documentation helper
"""
return getattr(self.getDocumentedObject(), "id", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' )
def getTitle(self):
"""
Returns the title of the documentation helper
"""
return getattr(self.getDocumentedObject(), "title", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getContentType' )
def getContentType(self): def getContentType(self):
""" """
Returns the title of the documentation helper Returns the title of the documentation helper
......
...@@ -26,12 +26,10 @@ ...@@ -26,12 +26,10 @@
# #
############################################################################## ##############################################################################
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass from Globals import InitializeClass
from DocumentationHelper import DocumentationHelper from DocumentationHelper import DocumentationHelper, getCallableSignatureString
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from AccessorMethodDocumentationHelper import getDefinitionString
class WorkflowMethodDocumentationHelper(DocumentationHelper): class WorkflowMethodDocumentationHelper(DocumentationHelper):
""" """
...@@ -40,39 +38,32 @@ class WorkflowMethodDocumentationHelper(DocumentationHelper): ...@@ -40,39 +38,32 @@ class WorkflowMethodDocumentationHelper(DocumentationHelper):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
def __init__(self, uri):
self.uri = uri
security.declareProtected(Permissions.AccessContentsInformation, 'getDescription') security.declareProtected(Permissions.AccessContentsInformation, 'getDescription')
def getDescription(self): def getDescription(self):
return getattr(self.getDocumentedObject(), "__doc__", '') """
"""
return self.getDocumentedObject().__doc__
security.declareProtected(Permissions.AccessContentsInformation, 'getType' ) security.declareProtected(Permissions.AccessContentsInformation, 'getType')
def getType(self): def getType(self):
""" """
Returns the type of the documentation helper Returns the type of the documentation helper
""" """
return "Workflow Method" return "Workflow Method"
security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' ) security.declareProtected(Permissions.AccessContentsInformation, 'getTitle')
def getTitle(self): def getTitle(self):
""" """
Returns the title of the documentation helper Returns the title of the documentation helper
""" """
# XXX May return _doNothing
return getattr(self.getDocumentedObject(), "_transition_id", '') return getattr(self.getDocumentedObject(), "_transition_id", '')
security.declareProtected( Permissions.AccessContentsInformation, 'getSectionList' ) security.declareProtected(Permissions.AccessContentsInformation, 'getDefinition')
def getSectionList(self):
"""
Returns a list of documentation sections
"""
return []
security.declareProtected( Permissions.AccessContentsInformation, 'getDefinition' )
def getDefinition(self): def getDefinition(self):
""" """
Returns the definition of the workflow_method with the name and arguments Returns the definition of the workflow_method with the name and arguments
""" """
return getDefinitionString(self.getDocumentedObject()) return getCallableSignatureString(self.getDocumentedObject().im_func._m)
InitializeClass(WorkflowMethodDocumentationHelper) InitializeClass(WorkflowMethodDocumentationHelper)
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
# #
############################################################################## ##############################################################################
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass from Globals import InitializeClass
from DocumentationHelper import DocumentationHelper from DocumentationHelper import DocumentationHelper
...@@ -39,31 +38,14 @@ class ZSQLMethodDocumentationHelper(DocumentationHelper): ...@@ -39,31 +38,14 @@ class ZSQLMethodDocumentationHelper(DocumentationHelper):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
def __init__(self, uri): security.declareProtected(Permissions.AccessContentsInformation, 'getType')
self.uri = uri
security.declareProtected(Permissions.AccessContentsInformation, 'getType' )
def getType(self): def getType(self):
""" """
Returns the type of the documentation helper Returns the type of the documentation helper
""" """
return "Z SQL Method" return "Z SQL Method"
security.declareProtected(Permissions.AccessContentsInformation, 'getId' ) security.declareProtected(Permissions.AccessContentsInformation, 'getSource')
def getId(self):
"""
Returns the id of the documentation helper
"""
return getattr(self.getDocumentedObject(), "id", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' )
def getTitle(self):
"""
Returns the title of the documentation helper
"""
return getattr(self.getDocumentedObject(), "title", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getSource' )
def getSource(self): def getSource(self):
""" """
Returns the source code of the documentation helper Returns the source code of the documentation helper
...@@ -85,35 +67,35 @@ class ZSQLMethodDocumentationHelper(DocumentationHelper): ...@@ -85,35 +67,35 @@ class ZSQLMethodDocumentationHelper(DocumentationHelper):
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()
security.declareProtected(Permissions.AccessContentsInformation, 'getConnectionId' ) security.declareProtected(Permissions.AccessContentsInformation, 'getConnectionId')
def getConnectionId(self): def getConnectionId(self):
""" """
Returns the title of the documentation helper Returns the title of the documentation helper
""" """
return getattr(self.getDocumentedObject(), "connection_id", '') return getattr(self.getDocumentedObject(), "connection_id", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getArgumentList' ) security.declareProtected(Permissions.AccessContentsInformation, 'getArgumentList')
def getArgumentList(self): def getArgumentList(self):
""" """
Returns the arguments of the documentation helper Returns the arguments of the documentation helper
""" """
return getattr(self.getDocumentedObject(), "arguments_src", []) return getattr(self.getDocumentedObject(), "arguments_src", [])
security.declareProtected(Permissions.AccessContentsInformation, 'getClassName' ) security.declareProtected(Permissions.AccessContentsInformation, 'getClassName')
def getClassName(self): def getClassName(self):
""" """
Returns the class name of the documentation helper Returns the class name of the documentation helper
""" """
return getattr(self.getDocumentedObject(), "class_name_", '') return getattr(self.getDocumentedObject(), "class_name_", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getClassFile' ) security.declareProtected(Permissions.AccessContentsInformation, 'getClassFile')
def getClassFile(self): def getClassFile(self):
""" """
Returns the class file of the documentation helper Returns the class file of the documentation helper
""" """
return getattr(self.getDocumentedObject(), "class_file_", '') return getattr(self.getDocumentedObject(), "class_file_", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getMaxRows' ) security.declareProtected(Permissions.AccessContentsInformation, 'getMaxRows')
def getMaxRows(self): def getMaxRows(self):
""" """
Returns the of the documentation helper Returns the of the documentation helper
......
# -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
# Copyright (c) 2007-2008 Nexedi SA and Contributors. All Rights Reserved. # Copyright (c) 2007-2008 Nexedi SA and Contributors. All Rights Reserved.
...@@ -49,7 +50,6 @@ from WorkflowMethodDocumentationHelper import WorkflowMethodDocumentationHelper ...@@ -49,7 +50,6 @@ from WorkflowMethodDocumentationHelper import WorkflowMethodDocumentationHelper
from DCWorkflowStateDocumentationHelper import DCWorkflowStateDocumentationHelper from DCWorkflowStateDocumentationHelper import DCWorkflowStateDocumentationHelper
from DCWorkflowTransitionDocumentationHelper import DCWorkflowTransitionDocumentationHelper from DCWorkflowTransitionDocumentationHelper import DCWorkflowTransitionDocumentationHelper
from DCWorkflowVariableDocumentationHelper import DCWorkflowVariableDocumentationHelper from DCWorkflowVariableDocumentationHelper import DCWorkflowVariableDocumentationHelper
from DCWorkflowPermissionDocumentationHelper import DCWorkflowPermissionDocumentationHelper
from DCWorkflowWorklistDocumentationHelper import DCWorkflowWorklistDocumentationHelper from DCWorkflowWorklistDocumentationHelper import DCWorkflowWorklistDocumentationHelper
from DCWorkflowScriptDocumentationHelper import DCWorkflowScriptDocumentationHelper from DCWorkflowScriptDocumentationHelper import DCWorkflowScriptDocumentationHelper
from SkinFolderDocumentationHelper import SkinFolderDocumentationHelper from SkinFolderDocumentationHelper import SkinFolderDocumentationHelper
......
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