Commit 8a6248c2 authored by Julien Muchembled's avatar Julien Muchembled

* replace tabs with spaces

 * remove trailing spaces

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21612 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 307f3e9a
...@@ -194,10 +194,10 @@ class BusinessTemplateDocumentationHelper(DocumentationHelper): ...@@ -194,10 +194,10 @@ class BusinessTemplateDocumentationHelper(DocumentationHelper):
dc_workflow_list = [] dc_workflow_list = []
template_workflow_id_list = getattr(self.getDocumentedObject(), 'template_workflow_id', []) template_workflow_id_list = getattr(self.getDocumentedObject(), 'template_workflow_id', [])
for wf in template_workflow_id_list: for wf in template_workflow_id_list:
url = '/' + self.getPortalObject().id + '/portal_workflow/' + wf url = '/' + self.getPortalObject().id + '/portal_workflow/' + wf
wf_object = self.getPortalObject().unrestrictedTraverse(url) wf_object = self.getPortalObject().unrestrictedTraverse(url)
if wf_object.__class__.__name__ == 'DCWorkflowDefinition': if wf_object.__class__.__name__ == 'DCWorkflowDefinition':
dc_workflow_list.append(wf) dc_workflow_list.append(wf)
return dc_workflow_list return dc_workflow_list
security.declareProtected( Permissions.AccessContentsInformation, 'getDCWorkflowURIList' ) security.declareProtected( Permissions.AccessContentsInformation, 'getDCWorkflowURIList' )
......
...@@ -96,7 +96,7 @@ class CatalogMethodDocumentationHelper(DocumentationHelper): ...@@ -96,7 +96,7 @@ class CatalogMethodDocumentationHelper(DocumentationHelper):
keys = [] keys = []
arg = getattr(self.getDocumentedObject(), '_arg', None) arg = getattr(self.getDocumentedObject(), '_arg', None)
if arg is not None: if arg is not None:
keys = getattr(arg, '_keys', []) keys = getattr(arg, '_keys', [])
return keys return keys
security.declareProtected(Permissions.AccessContentsInformation, 'getCatalog' ) security.declareProtected(Permissions.AccessContentsInformation, 'getCatalog' )
......
...@@ -38,17 +38,17 @@ def getStatePermissionsOfRole(state=None, role=''): ...@@ -38,17 +38,17 @@ def getStatePermissionsOfRole(state=None, role=''):
permissions = "" permissions = ""
if state != None: if state != None:
if hasattr(state, '__dict__'): if hasattr(state, '__dict__'):
if 'permission_roles' in state.__dict__.keys(): if 'permission_roles' in state.__dict__.keys():
if 'View' in state.__dict__['permission_roles'].keys(): if 'View' in state.__dict__['permission_roles'].keys():
if role in state.__dict__['permission_roles']['View']: if role in state.__dict__['permission_roles']['View']:
permissions += "V" permissions += "V"
if 'Access contents information' in state.__dict__['permission_roles'].keys(): if 'Access contents information' in state.__dict__['permission_roles'].keys():
if role in state.__dict__['permission_roles']['Access contents information']: if role in state.__dict__['permission_roles']['Access contents information']:
permissions += "A" permissions += "A"
if 'Modify portal content' in state.__dict__['permission_roles'].keys(): if 'Modify portal content' in state.__dict__['permission_roles'].keys():
if role in state.__dict__['permission_roles']['Modify portal content']: if role in state.__dict__['permission_roles']['Modify portal content']:
permissions += "M" permissions += "M"
if 'Add portal content' in state.__dict__['permission_roles'].keys(): if 'Add portal content' in state.__dict__['permission_roles'].keys():
if role in state.__dict__['permission_roles']['Add portal content']: if role in state.__dict__['permission_roles']['Add portal content']:
permissions += "C" permissions += "C"
return permissions return permissions
...@@ -62,12 +62,12 @@ class DCWorkflowDocumentationHelper(DocumentationHelper): ...@@ -62,12 +62,12 @@ class DCWorkflowDocumentationHelper(DocumentationHelper):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
def __init__(self, uri): def __init__(self, uri):
self.uri = uri self.uri = uri
def getInstance(self): def getInstance(self):
return self.getPortalObject().restrictedTraverse(self.uri) return self.getPortalObject().restrictedTraverse(self.uri)
# API Implementation # API Implementation
security.declareProtected( Permissions.AccessContentsInformation, 'getId' ) security.declareProtected( Permissions.AccessContentsInformation, 'getId' )
...@@ -155,7 +155,7 @@ class DCWorkflowDocumentationHelper(DocumentationHelper): ...@@ -155,7 +155,7 @@ class DCWorkflowDocumentationHelper(DocumentationHelper):
for state in states.objectValues(): for state in states.objectValues():
state_list.append(state.getId()) state_list.append(state.getId())
return state_list return state_list
security.declareProtected( Permissions.AccessContentsInformation, 'getStateItemList' ) security.declareProtected( Permissions.AccessContentsInformation, 'getStateItemList' )
def getStateItemList(self): def getStateItemList(self):
""" """
...@@ -168,7 +168,7 @@ class DCWorkflowDocumentationHelper(DocumentationHelper): ...@@ -168,7 +168,7 @@ class DCWorkflowDocumentationHelper(DocumentationHelper):
getattr(state, "title", ""), getattr(state, "title", ""),
getStatePermissionsOfRole(state, 'Owner'), getStatePermissionsOfRole(state, 'Owner'),
getStatePermissionsOfRole(state, 'Assignor'), getStatePermissionsOfRole(state, 'Assignor'),
getStatePermissionsOfRole(state, 'Assignee'), getStatePermissionsOfRole(state, 'Assignee'),
getStatePermissionsOfRole(state, 'Associate'), getStatePermissionsOfRole(state, 'Associate'),
getStatePermissionsOfRole(state, 'Author'), getStatePermissionsOfRole(state, 'Author'),
getStatePermissionsOfRole(state, 'Auditor') getStatePermissionsOfRole(state, 'Auditor')
...@@ -219,9 +219,9 @@ class DCWorkflowDocumentationHelper(DocumentationHelper): ...@@ -219,9 +219,9 @@ class DCWorkflowDocumentationHelper(DocumentationHelper):
if hasattr(transition.guard, '__dict__'): if hasattr(transition.guard, '__dict__'):
if 'roles' in transition.guard.__dict__.keys(): if 'roles' in transition.guard.__dict__.keys():
guard_roles = ', '.join(role for role in transition.guard.__dict__['roles']) guard_roles = ', '.join(role for role in transition.guard.__dict__['roles'])
transition_list.append((transition.getId(), transition_list.append((transition.getId(),
getattr(transition, "title", ""), getattr(transition, "title", ""),
trigger_type_list[transition.trigger_type], trigger_type_list[transition.trigger_type],
getattr(transition, "description", ""), getattr(transition, "description", ""),
guard_roles guard_roles
)) ))
...@@ -264,10 +264,10 @@ class DCWorkflowDocumentationHelper(DocumentationHelper): ...@@ -264,10 +264,10 @@ class DCWorkflowDocumentationHelper(DocumentationHelper):
variables = getattr(self.getInstance(), 'variables', None) variables = getattr(self.getInstance(), 'variables', None)
if variables is not None: if variables is not None:
for variable in variables.objectValues(): for variable in variables.objectValues():
variable_list.append((variable.getId(), variable_list.append((variable.getId(),
getattr(variable, "title", ""), getattr(variable, "title", ""),
getattr(variable, "description", "") getattr(variable, "description", "")
)) ))
return variable_list return variable_list
security.declareProtected( Permissions.AccessContentsInformation, 'getVariableURIList' ) security.declareProtected( Permissions.AccessContentsInformation, 'getVariableURIList' )
...@@ -298,7 +298,7 @@ class DCWorkflowDocumentationHelper(DocumentationHelper): ...@@ -298,7 +298,7 @@ class DCWorkflowDocumentationHelper(DocumentationHelper):
for permission in permissions: for permission in permissions:
permission_list.append(permission) permission_list.append(permission)
return permission_list return permission_list
security.declareProtected( Permissions.AccessContentsInformation, 'getPermissionURIList' ) security.declareProtected( Permissions.AccessContentsInformation, 'getPermissionURIList' )
def getPermissionURIList(self): def getPermissionURIList(self):
...@@ -310,14 +310,14 @@ class DCWorkflowDocumentationHelper(DocumentationHelper): ...@@ -310,14 +310,14 @@ class DCWorkflowDocumentationHelper(DocumentationHelper):
module = klass.__module__ module = klass.__module__
uri_prefix = '%s.%s.' % (module, class_name) uri_prefix = '%s.%s.' % (module, class_name)
return map(lambda x: '%s%s' % (uri_prefix, x), permission_id_list) return map(lambda x: '%s%s' % (uri_prefix, x), permission_id_list)
security.declareProtected( Permissions.AccessContentsInformation, 'getPermissionUriList' ) security.declareProtected( Permissions.AccessContentsInformation, 'getPermissionUriList' )
def getPermissionUriList(self): def getPermissionUriList(self):
""" """
""" """
permission_id_list = self.getPermissionIdList() permission_id_list = self.getPermissionIdList()
return map(lambda x: '%s/permissions/%s' % (self.uri, x), permission_id_list) return map(lambda x: '%s/permissions/%s' % (self.uri, x), permission_id_list)
security.declareProtected( Permissions.AccessContentsInformation, 'getWorklistIdList' ) security.declareProtected( Permissions.AccessContentsInformation, 'getWorklistIdList' )
def getWorklistIdList(self): def getWorklistIdList(self):
""" """
...@@ -342,14 +342,14 @@ class DCWorkflowDocumentationHelper(DocumentationHelper): ...@@ -342,14 +342,14 @@ class DCWorkflowDocumentationHelper(DocumentationHelper):
if wl.title == "": if wl.title == "":
title = wl.actbox_name title = wl.actbox_name
else: else:
title = wl.title title = wl.title
if hasattr(wl.guard, '__dict__'): if hasattr(wl.guard, '__dict__'):
if 'roles' in wl.guard.__dict__.keys(): if 'roles' in wl.guard.__dict__.keys():
guard_roles = ', '.join(role for role in wl.guard.__dict__['roles']) guard_roles = ', '.join(role for role in wl.guard.__dict__['roles'])
worklist_list.append((wl.__name__, title, wl.__dict__["description"],guard_roles)) worklist_list.append((wl.__name__, title, wl.__dict__["description"],guard_roles))
return worklist_list return worklist_list
security.declareProtected( Permissions.AccessContentsInformation, 'getWorklistURIList' ) security.declareProtected( Permissions.AccessContentsInformation, 'getWorklistURIList' )
def getWorklistURIList(self): def getWorklistURIList(self):
""" """
...@@ -387,9 +387,9 @@ class DCWorkflowDocumentationHelper(DocumentationHelper): ...@@ -387,9 +387,9 @@ class DCWorkflowDocumentationHelper(DocumentationHelper):
scripts = getattr(self.getInstance(), "scripts", None) scripts = getattr(self.getInstance(), "scripts", None)
if scripts is not None: if scripts is not None:
for script in scripts.objectValues(): for script in scripts.objectValues():
script_list.append((getattr(script, "__name__", ''), script_list.append((getattr(script, "__name__", ''),
getattr(script, "title", '') getattr(script, "title", '')
)) ))
return script_list return script_list
......
...@@ -93,10 +93,10 @@ class DCWorkflowScriptDocumentationHelper(DocumentationHelper): ...@@ -93,10 +93,10 @@ class DCWorkflowScriptDocumentationHelper(DocumentationHelper):
REQUEST = getattr(self, 'REQUEST', None) REQUEST = getattr(self, 'REQUEST', None)
if REQUEST is not None: if REQUEST is not None:
if REQUEST.get('portal_skin', 'View' ) != 'View': if REQUEST.get('portal_skin', 'View' ) != 'View':
return source_code return source_code
else: else:
LOG('DCWorkflowScriptDocumentationHelper', INFO, LOG('DCWorkflowScriptDocumentationHelper', INFO,
'Transformation Tool is not installed. No convertion of python script to html') 'Transformation Tool is not installed. No convertion of python script to html')
return source_code return source_code
src_mimetype='text/x-python' src_mimetype='text/x-python'
mime_type = 'text/html' mime_type = 'text/html'
......
...@@ -119,10 +119,10 @@ class DCWorkflowTransitionDocumentationHelper(DocumentationHelper): ...@@ -119,10 +119,10 @@ class DCWorkflowTransitionDocumentationHelper(DocumentationHelper):
""" """
role_list = () role_list = ()
if hasattr(self.getDocumentedObject(),'guard'): if hasattr(self.getDocumentedObject(),'guard'):
dir(self.getDocumentedObject().guard) dir(self.getDocumentedObject().guard)
if hasattr(self.getDocumentedObject().guard, '__dict__'): if hasattr(self.getDocumentedObject().guard, '__dict__'):
if 'roles' in self.getDocumentedObject().guard.__dict__.keys(): if 'roles' in self.getDocumentedObject().guard.__dict__.keys():
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)
InitializeClass(DCWorkflowTransitionDocumentationHelper) InitializeClass(DCWorkflowTransitionDocumentationHelper)
...@@ -75,8 +75,8 @@ class DCWorkflowWorklistDocumentationHelper(DocumentationHelper): ...@@ -75,8 +75,8 @@ class DCWorkflowWorklistDocumentationHelper(DocumentationHelper):
""" """
if self.getDocumentedObject().title == "": if self.getDocumentedObject().title == "":
return self.getDocumentedObject().actbox_name return self.getDocumentedObject().actbox_name
else: else:
return self.getDocumentedObject().title return self.getDocumentedObject().title
security.declareProtected(Permissions.AccessContentsInformation, 'getGuardRoles' ) security.declareProtected(Permissions.AccessContentsInformation, 'getGuardRoles' )
def getGuardRoles(self): def getGuardRoles(self):
...@@ -103,6 +103,6 @@ class DCWorkflowWorklistDocumentationHelper(DocumentationHelper): ...@@ -103,6 +103,6 @@ class DCWorkflowWorklistDocumentationHelper(DocumentationHelper):
for key in var_matches.keys(): for key in var_matches.keys():
var_matches_list.append('%s: %s' % (key, ', '.join(x for x in var_matches[key]))) var_matches_list.append('%s: %s' % (key, ', '.join(x for x in var_matches[key])))
#var_matches_list.append((key, '%s' % ', '.join(x for x in var_matches[key]))) #var_matches_list.append((key, '%s' % ', '.join(x for x in var_matches[key])))
return var_matches_list return var_matches_list
InitializeClass(DCWorkflowWorklistDocumentationHelper) InitializeClass(DCWorkflowWorklistDocumentationHelper)
...@@ -101,8 +101,8 @@ class DocumentationHelper(Implicit): ...@@ -101,8 +101,8 @@ class DocumentationHelper(Implicit):
def getDocumentedObject(self): def getDocumentedObject(self):
if self.uri.startswith('portal_classes/temp_instance'): if self.uri.startswith('portal_classes/temp_instance'):
url, method = self.uri.split('#') url, method = self.uri.split('#')
portal_type = url.split('/')[-1] portal_type = url.split('/')[-1]
#temp_folder = self.getPortalObject().portal_classes.newContent(id='temp_instance', portal_type='Folder', temp_object=1) #temp_folder = self.getPortalObject().portal_classes.newContent(id='temp_instance', portal_type='Folder', temp_object=1)
#temp_object = temp_folder.newContent(id=portal_type, portal_type=portal_type, temp_object=1) #temp_object = temp_folder.newContent(id=portal_type, portal_type=portal_type, temp_object=1)
self.getTempInstance = TempObjectLibrary(self.getPortalObject().portal_classes) self.getTempInstance = TempObjectLibrary(self.getPortalObject().portal_classes)
...@@ -118,14 +118,14 @@ class DocumentationHelper(Implicit): ...@@ -118,14 +118,14 @@ class DocumentationHelper(Implicit):
file_name = self.uri.split('/')[-1] file_name = self.uri.split('/')[-1]
file_url = '' file_url = ''
list_path = os.listdir(instance_home+'/Products') list_path = os.listdir(instance_home+'/Products')
zope_property_sheet = instance_home + '/PropertySheet' zope_property_sheet = instance_home + '/PropertySheet'
list_propertysheets = [zope_property_sheet,] list_propertysheets = [zope_property_sheet,]
for path in list_path: for path in list_path:
full_path = instance_home+'/Products/'+path full_path = instance_home+'/Products/'+path
if os.path.isdir(full_path) and os.path.exists(full_path+'/PropertySheet'): if os.path.isdir(full_path) and os.path.exists(full_path+'/PropertySheet'):
list_propertysheets.append(full_path+'/PropertySheet') list_propertysheets.append(full_path+'/PropertySheet')
for propertysheet_directory in list_propertysheets: for propertysheet_directory in list_propertysheets:
if os.path.exists(propertysheet_directory+'/'+file_name): if os.path.exists(propertysheet_directory+'/'+file_name):
file_url = propertysheet_directory+'/'+file_name file_url = propertysheet_directory+'/'+file_name
documented_object = open(file_url) documented_object = open(file_url)
elif '/' in self.uri and '#' not in self.uri: elif '/' in self.uri and '#' not in self.uri:
...@@ -134,20 +134,20 @@ class DocumentationHelper(Implicit): ...@@ -134,20 +134,20 @@ class DocumentationHelper(Implicit):
try: try:
documented_object = self.getPortalObject().portal_categories.resolveCategory(self.uri) documented_object = self.getPortalObject().portal_categories.resolveCategory(self.uri)
except: except:
documented_object = None documented_object = None
if documented_object is None: if documented_object is None:
documented_object = self.getPortalObject().unrestrictedTraverse(self.uri) documented_object = self.getPortalObject().unrestrictedTraverse(self.uri)
elif '/' in self.uri and '#' in self.uri: elif '/' in self.uri and '#' in self.uri:
if '?' in self.uri: if '?' in self.uri:
base_url, url = self.uri.split('?') base_url, url = self.uri.split('?')
type, name = url.split('#') type, name = url.split('#')
parent_object = self.getPortalObject().unrestrictedTraverse(base_url) parent_object = self.getPortalObject().unrestrictedTraverse(base_url)
object_list = getattr(parent_object, type, None) object_list = getattr(parent_object, type, None)
documented_object = None documented_object = None
if object_list is not None: if object_list is not None:
for obj in object_list: for obj in object_list:
if obj.__name__ == name: if obj.__name__ == name:
documented_object = obj documented_object = obj
else: else:
url, method = self.uri.split('#') url, method = self.uri.split('#')
documented_object = self.getPortalObject().unrestrictedTraverse(url) documented_object = self.getPortalObject().unrestrictedTraverse(url)
...@@ -171,7 +171,7 @@ class DocumentationHelper(Implicit): ...@@ -171,7 +171,7 @@ class DocumentationHelper(Implicit):
for key in module_list[1:]: for key in module_list[1:]:
documented_object = getattr(documented_object, key) documented_object = getattr(documented_object, key)
else: else:
raise NotImplemented raise NotImplemented
#fp, pathname, description = imp.find_module(base_module) #fp, pathname, description = imp.find_module(base_module)
#documented_object = imp.load_module(fp, pathname, description) #documented_object = imp.load_module(fp, pathname, description)
return documented_object return documented_object
......
...@@ -79,7 +79,7 @@ class ERP5SiteDocumentationHelper(DocumentationHelper): ...@@ -79,7 +79,7 @@ class ERP5SiteDocumentationHelper(DocumentationHelper):
Returns the description of the documentation helper Returns the description of the documentation helper
""" """
return getattr(self.getDocumentedObject(), "description", '') return getattr(self.getDocumentedObject(), "description", '')
security.declareProtected( Permissions.AccessContentsInformation, 'getBusinessTemplateIdList' ) security.declareProtected( Permissions.AccessContentsInformation, 'getBusinessTemplateIdList' )
def getBusinessTemplateIdList(self): def getBusinessTemplateIdList(self):
""" """
...@@ -87,9 +87,9 @@ class ERP5SiteDocumentationHelper(DocumentationHelper): ...@@ -87,9 +87,9 @@ class ERP5SiteDocumentationHelper(DocumentationHelper):
bt_list = [] bt_list = []
for bt in self.getDocumentedObject().portal_templates.objectValues(): for bt in self.getDocumentedObject().portal_templates.objectValues():
current_state = '' current_state = ''
for wh in bt.workflow_history['business_template_installation_workflow']: for wh in bt.workflow_history['business_template_installation_workflow']:
current_state = wh['installation_state'] current_state = wh['installation_state']
if current_state == 'installed': if current_state == 'installed':
bt_list.append(bt.getId()) bt_list.append(bt.getId())
return bt_list return bt_list
...@@ -104,13 +104,13 @@ class ERP5SiteDocumentationHelper(DocumentationHelper): ...@@ -104,13 +104,13 @@ class ERP5SiteDocumentationHelper(DocumentationHelper):
current_state = '' current_state = ''
for wh in bt.workflow_history['business_template_installation_workflow']: for wh in bt.workflow_history['business_template_installation_workflow']:
current_state = wh['installation_state'] current_state = wh['installation_state']
if current_state == 'installed': if current_state == 'installed':
bt_list.append((bt.getId(), bt_list.append((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", '')
)) ))
return bt_list return bt_list
security.declareProtected( Permissions.AccessContentsInformation, 'getBusinessTemplateURIList' ) security.declareProtected( Permissions.AccessContentsInformation, 'getBusinessTemplateURIList' )
......
...@@ -38,17 +38,17 @@ def getStatePermissionsOfRole(state=None, role=''): ...@@ -38,17 +38,17 @@ def getStatePermissionsOfRole(state=None, role=''):
permissions = "" permissions = ""
if state != None: if state != None:
if hasattr(state, '__dict__'): if hasattr(state, '__dict__'):
if 'permission_roles' in state.__dict__.keys(): if 'permission_roles' in state.__dict__.keys():
if 'View' in state.__dict__['permission_roles'].keys(): if 'View' in state.__dict__['permission_roles'].keys():
if role in state.__dict__['permission_roles']['View']: if role in state.__dict__['permission_roles']['View']:
permissions += "V" permissions += "V"
if 'Access contents information' in state.__dict__['permission_roles'].keys(): if 'Access contents information' in state.__dict__['permission_roles'].keys():
if role in state.__dict__['permission_roles']['Access contents information']: if role in state.__dict__['permission_roles']['Access contents information']:
permissions += "A" permissions += "A"
if 'Modify portal content' in state.__dict__['permission_roles'].keys(): if 'Modify portal content' in state.__dict__['permission_roles'].keys():
if role in state.__dict__['permission_roles']['Modify portal content']: if role in state.__dict__['permission_roles']['Modify portal content']:
permissions += "M" permissions += "M"
if 'Add portal content' in state.__dict__['permission_roles'].keys(): if 'Add portal content' in state.__dict__['permission_roles'].keys():
if role in state.__dict__['permission_roles']['Add portal content']: if role in state.__dict__['permission_roles']['Add portal content']:
permissions += "C" permissions += "C"
return permissions return permissions
...@@ -62,12 +62,12 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper): ...@@ -62,12 +62,12 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
def __init__(self, uri): def __init__(self, uri):
self.uri = uri self.uri = uri
def getInstance(self): def getInstance(self):
return self.getPortalObject().restrictedTraverse(self.uri) return self.getPortalObject().restrictedTraverse(self.uri)
# API Implementation # API Implementation
security.declareProtected( Permissions.AccessContentsInformation, 'getId' ) security.declareProtected( Permissions.AccessContentsInformation, 'getId' )
...@@ -76,7 +76,7 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper): ...@@ -76,7 +76,7 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper):
Returns the Id of the documentation helper Returns the Id of the documentation helper
""" """
return getattr(self.getInstance(), "__name__", '') return getattr(self.getInstance(), "__name__", '')
security.declareProtected( Permissions.AccessContentsInformation, 'getType' ) security.declareProtected( Permissions.AccessContentsInformation, 'getType' )
def getType(self): def getType(self):
...@@ -151,24 +151,24 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper): ...@@ -151,24 +151,24 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper):
""" """
state_list = [] state_list = []
if hasattr(self.getInstance(), "states"): if hasattr(self.getInstance(), "states"):
if self.getInstance().states is not None: if self.getInstance().states is not None:
for state in self.getInstance().states.objectValues(): for state in self.getInstance().states.objectValues():
state_list.append(state.getId()) state_list.append(state.getId())
return state_list return state_list
security.declareProtected( Permissions.AccessContentsInformation, 'getStateItemList' ) security.declareProtected( Permissions.AccessContentsInformation, 'getStateItemList' )
def getStateItemList(self): def getStateItemList(self):
""" """
""" """
state_list = [] state_list = []
if hasattr(self.getInstance(), "states"): if hasattr(self.getInstance(), "states"):
if self.getInstance().states is not None: if self.getInstance().states is not None:
for state in self.getInstance().states.objectValues(): for state in self.getInstance().states.objectValues():
state_list.append((state.getId(), state_list.append((state.getId(),
state.__dict__["title"], state.__dict__["title"],
getStatePermissionsOfRole(state, 'Owner'), getStatePermissionsOfRole(state, 'Owner'),
getStatePermissionsOfRole(state, 'Assignor'), getStatePermissionsOfRole(state, 'Assignor'),
getStatePermissionsOfRole(state, 'Assignee'), getStatePermissionsOfRole(state, 'Assignee'),
getStatePermissionsOfRole(state, 'Associate'), getStatePermissionsOfRole(state, 'Associate'),
getStatePermissionsOfRole(state, 'Author'), getStatePermissionsOfRole(state, 'Author'),
getStatePermissionsOfRole(state, 'Auditor') getStatePermissionsOfRole(state, 'Auditor')
...@@ -200,7 +200,7 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper): ...@@ -200,7 +200,7 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper):
""" """
transition_list = [] transition_list = []
if hasattr(self.getInstance(), "transitions"): if hasattr(self.getInstance(), "transitions"):
if self.getInstance().transitions is not None: if self.getInstance().transitions is not None:
for transition in self.getInstance().transitions.objectValues(): for transition in self.getInstance().transitions.objectValues():
transition_list.append(transition.getId()) transition_list.append(transition.getId())
return transition_list return transition_list
...@@ -212,16 +212,16 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper): ...@@ -212,16 +212,16 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper):
transition_list = [] transition_list = []
trigger_type_list = ['Automatic','Initiated by user action','Initiated by WorkflowMethod'] trigger_type_list = ['Automatic','Initiated by user action','Initiated by WorkflowMethod']
if hasattr(self.getInstance(), "transitions"): if hasattr(self.getInstance(), "transitions"):
if self.getInstance().transitions is not None: if self.getInstance().transitions is not None:
for transition in self.getInstance().transitions.objectValues(): for transition in self.getInstance().transitions.objectValues():
guard_roles = "" guard_roles = ""
guard = dir(transition.guard) guard = dir(transition.guard)
if hasattr(transition.guard, '__dict__'): if hasattr(transition.guard, '__dict__'):
if 'roles' in transition.guard.__dict__.keys(): if 'roles' in transition.guard.__dict__.keys():
guard_roles = ', '.join(role for role in transition.guard.__dict__['roles']) guard_roles = ', '.join(role for role in transition.guard.__dict__['roles'])
transition_list.append((transition.getId(), transition_list.append((transition.getId(),
transition.title, transition.title,
trigger_type_list[transition.trigger_type], trigger_type_list[transition.trigger_type],
transition.__dict__["description"], transition.__dict__["description"],
guard_roles guard_roles
)) ))
...@@ -251,7 +251,7 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper): ...@@ -251,7 +251,7 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper):
""" """
variable_list = [] variable_list = []
if hasattr(self.getInstance(), "variables"): if hasattr(self.getInstance(), "variables"):
if self.getInstance().variables is not None: if self.getInstance().variables is not None:
for variable in self.getInstance().variables.objectValues(): for variable in self.getInstance().variables.objectValues():
variable_list.append(variable.getId()) variable_list.append(variable.getId())
return variable_list return variable_list
...@@ -262,7 +262,7 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper): ...@@ -262,7 +262,7 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper):
""" """
variable_list = [] variable_list = []
if hasattr(self.getInstance(), "variables"): if hasattr(self.getInstance(), "variables"):
if self.getInstance().variables is not None: if self.getInstance().variables is not None:
for variable in self.getInstance().variables.objectValues(): for variable in self.getInstance().variables.objectValues():
variable_list.append((variable.getId(), variable.title, variable.__dict__["description"])) variable_list.append((variable.getId(), variable.title, variable.__dict__["description"]))
return variable_list return variable_list
...@@ -295,7 +295,7 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper): ...@@ -295,7 +295,7 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper):
for permission in self.getInstance().permissions: for permission in self.getInstance().permissions:
permission_list.append(permission) permission_list.append(permission)
return permission_list return permission_list
security.declareProtected( Permissions.AccessContentsInformation, 'getPermissionURIList' ) security.declareProtected( Permissions.AccessContentsInformation, 'getPermissionURIList' )
def getPermissionURIList(self): def getPermissionURIList(self):
...@@ -307,14 +307,14 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper): ...@@ -307,14 +307,14 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper):
module = klass.__module__ module = klass.__module__
uri_prefix = '%s.%s.' % (module, class_name) uri_prefix = '%s.%s.' % (module, class_name)
return map(lambda x: '%s%s' % (uri_prefix, x), permission_id_list) return map(lambda x: '%s%s' % (uri_prefix, x), permission_id_list)
security.declareProtected( Permissions.AccessContentsInformation, 'getPermissionUriList' ) security.declareProtected( Permissions.AccessContentsInformation, 'getPermissionUriList' )
def getPermissionUriList(self): def getPermissionUriList(self):
""" """
""" """
permission_id_list = self.getPermissionIdList() permission_id_list = self.getPermissionIdList()
return map(lambda x: '%s/permissions/%s' % (self.uri, x), permission_id_list) return map(lambda x: '%s/permissions/%s' % (self.uri, x), permission_id_list)
security.declareProtected( Permissions.AccessContentsInformation, 'getWorklistIdList' ) security.declareProtected( Permissions.AccessContentsInformation, 'getWorklistIdList' )
def getWorklistIdList(self): def getWorklistIdList(self):
""" """
...@@ -339,14 +339,14 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper): ...@@ -339,14 +339,14 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper):
if wl.title == "": if wl.title == "":
title = wl.actbox_name title = wl.actbox_name
else: else:
title = wl.title title = wl.title
if hasattr(wl.guard, '__dict__'): if hasattr(wl.guard, '__dict__'):
if 'roles' in wl.guard.__dict__.keys(): if 'roles' in wl.guard.__dict__.keys():
guard_roles = ', '.join(role for role in wl.guard.__dict__['roles']) guard_roles = ', '.join(role for role in wl.guard.__dict__['roles'])
worklist_list.append((wl.__name__, title, wl.__dict__["description"],guard_roles)) worklist_list.append((wl.__name__, title, wl.__dict__["description"],guard_roles))
return worklist_list return worklist_list
security.declareProtected( Permissions.AccessContentsInformation, 'getWorklistURIList' ) security.declareProtected( Permissions.AccessContentsInformation, 'getWorklistURIList' )
def getWorklistURIList(self): def getWorklistURIList(self):
""" """
......
...@@ -73,8 +73,8 @@ class PageTemplateDocumentationHelper(DocumentationHelper): ...@@ -73,8 +73,8 @@ class PageTemplateDocumentationHelper(DocumentationHelper):
source_code = getattr(self.getDocumentedObject(), "_text", '') source_code = getattr(self.getDocumentedObject(), "_text", '')
portal_transforms = getattr(self, 'portal_transforms', None) portal_transforms = getattr(self, 'portal_transforms', None)
if portal_transforms is None: if portal_transforms is None:
LOG('DCWorkflowScriptDocumentationHelper', INFO, LOG('DCWorkflowScriptDocumentationHelper', INFO,
'Transformation Tool is not installed. No convertion of python script to html') 'Transformation Tool is not installed. No convertion of python script to html')
return source_code return source_code
src_mimetype='text/plain' src_mimetype='text/plain'
mime_type = 'text/html' mime_type = 'text/html'
......
...@@ -43,7 +43,7 @@ def getPortalType(uri=''): ...@@ -43,7 +43,7 @@ def getPortalType(uri=''):
""" """
portal_type = '' portal_type = ''
uri_list = uri.split('/') uri_list = uri.split('/')
if len(uri_list) >= 3: if len(uri_list) >= 3:
portal_type = uri_list[3] portal_type = uri_list[3]
return portal_type return portal_type
...@@ -58,7 +58,7 @@ class PortalTypeDocumentationHelper(DocumentationHelper): ...@@ -58,7 +58,7 @@ class PortalTypeDocumentationHelper(DocumentationHelper):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
# API Implementation # API Implementation
security.declareProtected( Permissions.AccessContentsInformation, 'getTitle' ) security.declareProtected( Permissions.AccessContentsInformation, 'getTitle' )
def getTitle(self): def getTitle(self):
...@@ -83,7 +83,7 @@ class PortalTypeDocumentationHelper(DocumentationHelper): ...@@ -83,7 +83,7 @@ class PortalTypeDocumentationHelper(DocumentationHelper):
klass = self.getTempInstance(portal_type).__class__.__bases__[0] klass = self.getTempInstance(portal_type).__class__.__bases__[0]
return str(klass).split("'")[1] return str(klass).split("'")[1]
security.declareProtected( Permissions.AccessContentsInformation, 'getTempInstance' ) security.declareProtected( Permissions.AccessContentsInformation, 'getTempInstance' )
def getTempInstance(self, portal_type): def getTempInstance(self, portal_type):
""" """
...@@ -202,7 +202,7 @@ class PortalTypeDocumentationHelper(DocumentationHelper): ...@@ -202,7 +202,7 @@ class PortalTypeDocumentationHelper(DocumentationHelper):
if local_roles: if local_roles:
return 'Yes' return 'Yes'
else: else:
return 'No' return 'No'
security.declareProtected( Permissions.AccessContentsInformation, 'getPropertySheetList' ) security.declareProtected( Permissions.AccessContentsInformation, 'getPropertySheetList' )
def getPropertySheetList(self): def getPropertySheetList(self):
...@@ -216,7 +216,7 @@ class PortalTypeDocumentationHelper(DocumentationHelper): ...@@ -216,7 +216,7 @@ class PortalTypeDocumentationHelper(DocumentationHelper):
property_sheet.append(obj.__module__.split('.')[-1]) property_sheet.append(obj.__module__.split('.')[-1])
for obj in self.getDocumentedObject().property_sheet_list: for obj in self.getDocumentedObject().property_sheet_list:
property_sheet.append(obj) property_sheet.append(obj)
return property_sheet return property_sheet
security.declareProtected( Permissions.AccessContentsInformation, 'getPropertySheetURIList' ) security.declareProtected( Permissions.AccessContentsInformation, 'getPropertySheetURIList' )
def getPropertySheetURIList(self): def getPropertySheetURIList(self):
...@@ -248,9 +248,9 @@ class PortalTypeDocumentationHelper(DocumentationHelper): ...@@ -248,9 +248,9 @@ class PortalTypeDocumentationHelper(DocumentationHelper):
""" """
""" """
action_list = [] action_list = []
TITLE =['No', 'Yes'] TITLE =['No', 'Yes']
for action in self.getDocumentedObject()._actions: for action in self.getDocumentedObject()._actions:
permission = ', '.join(x for x in action.permissions) permission = ', '.join(x for x in action.permissions)
visible = TITLE[action.visible] visible = TITLE[action.visible]
category = action.category category = action.category
action_list.append((action.getId(), action.title, action.Description(), permission, visible, category)) action_list.append((action.getId(), action.title, action.Description(), permission, visible, category))
...@@ -317,12 +317,12 @@ class PortalTypeDocumentationHelper(DocumentationHelper): ...@@ -317,12 +317,12 @@ class PortalTypeDocumentationHelper(DocumentationHelper):
temp_object = self.getTempInstance(portal_type) temp_object = self.getTempInstance(portal_type)
dir_temp = dir(temp_object) dir_temp = dir(temp_object)
return Base.aq_portal_type[(portal_type, temp_object.__class__)] return Base.aq_portal_type[(portal_type, temp_object.__class__)]
security.declareProtected(Permissions.AccessContentsInformation, 'getWorkflowMethodIdList' ) security.declareProtected(Permissions.AccessContentsInformation, 'getWorkflowMethodIdList' )
def getWorkflowMethodIdList(self, inherited=1): def getWorkflowMethodIdList(self, inherited=1):
""" """
""" """
return self._getPropertyHolder().getWorkflowMethodIdList() return self._getPropertyHolder().getWorkflowMethodIdList()
security.declareProtected(Permissions.AccessContentsInformation, 'getWorkflowMethodURIList' ) security.declareProtected(Permissions.AccessContentsInformation, 'getWorkflowMethodURIList' )
def getWorkflowMethodURIList(self, inherited=1, local=1): def getWorkflowMethodURIList(self, inherited=1, local=1):
...@@ -349,8 +349,8 @@ class PortalTypeDocumentationHelper(DocumentationHelper): ...@@ -349,8 +349,8 @@ class PortalTypeDocumentationHelper(DocumentationHelper):
module = klass.__module__ module = klass.__module__
uri_prefix = 'portal_classes/temp_instance/%s' % self.uri.split('/')[-1] uri_prefix = 'portal_classes/temp_instance/%s' % self.uri.split('/')[-1]
return map(lambda x: '%s#%s' % (uri_prefix, x), method_id_list) return map(lambda x: '%s#%s' % (uri_prefix, x), method_id_list)
security.declareProtected( Permissions.AccessContentsInformation, 'getClassMethodIdList' ) security.declareProtected( Permissions.AccessContentsInformation, 'getClassMethodIdList' )
def getClassMethodIdList(self, inherited=1, local=1): def getClassMethodIdList(self, inherited=1, local=1):
""" """
......
...@@ -135,13 +135,13 @@ class PortalTypeInstanceDocumentationHelper(DocumentationHelper): ...@@ -135,13 +135,13 @@ class PortalTypeInstanceDocumentationHelper(DocumentationHelper):
""" """
""" """
return self._getPropertyHolder() return self._getPropertyHolder()
security.declareProtected(Permissions.AccessContentsInformation, 'getWorkflowMethodIdList' ) security.declareProtected(Permissions.AccessContentsInformation, 'getWorkflowMethodIdList' )
def getWorkflowMethodIdList(self, inherited=1): def getWorkflowMethodIdList(self, inherited=1):
""" """
""" """
return self._getPropertyHolder().getWorkflowMethodIdList() return self._getPropertyHolder().getWorkflowMethodIdList()
security.declareProtected(Permissions.AccessContentsInformation, 'getWorkflowMethodURIList' ) security.declareProtected(Permissions.AccessContentsInformation, 'getWorkflowMethodURIList' )
def getWorkflowMethodURIList(self, inherited=1, local=1): def getWorkflowMethodURIList(self, inherited=1, local=1):
""" """
......
...@@ -73,12 +73,12 @@ class PortalTypePropertySheetDocumentationHelper(DocumentationHelper): ...@@ -73,12 +73,12 @@ class PortalTypePropertySheetDocumentationHelper(DocumentationHelper):
source_code = "" source_code = ""
property_sheet_file = self.getDocumentedObject() property_sheet_file = self.getDocumentedObject()
if property_sheet_file is not None: if property_sheet_file is not None:
property_sheet_file.seek(0) property_sheet_file.seek(0)
source_code = property_sheet_file.read() source_code = property_sheet_file.read()
portal_transforms = getattr(self, 'portal_transforms', None) portal_transforms = getattr(self, 'portal_transforms', None)
if portal_transforms is None: if portal_transforms is None:
LOG('DCWorkflowScriptDocumentationHelper', INFO, LOG('DCWorkflowScriptDocumentationHelper', INFO,
'Transformation Tool is not installed. No convertion of python script to html') 'Transformation Tool is not installed. No convertion of python script to html')
return source_code return source_code
src_mimetype='text/x-python' src_mimetype='text/x-python'
mime_type = 'text/html' mime_type = 'text/html'
......
...@@ -72,8 +72,8 @@ class ScriptPythonDocumentationHelper(DocumentationHelper): ...@@ -72,8 +72,8 @@ class ScriptPythonDocumentationHelper(DocumentationHelper):
source_code = getattr(self.getDocumentedObject(), "_body", '') source_code = getattr(self.getDocumentedObject(), "_body", '')
portal_transforms = getattr(self, 'portal_transforms', None) portal_transforms = getattr(self, 'portal_transforms', None)
if portal_transforms is None: if portal_transforms is None:
LOG('DCWorkflowScriptDocumentationHelper', INFO, LOG('DCWorkflowScriptDocumentationHelper', INFO,
'Transformation Tool is not installed. No convertion of python script to html') 'Transformation Tool is not installed. No convertion of python script to html')
return source_code return source_code
src_mimetype='text/x-python' src_mimetype='text/x-python'
mime_type = 'text/html' mime_type = 'text/html'
......
...@@ -73,7 +73,7 @@ class SkinFolderDocumentationHelper(DocumentationHelper): ...@@ -73,7 +73,7 @@ class SkinFolderDocumentationHelper(DocumentationHelper):
security.declareProtected(Permissions.AccessContentsInformation, 'getMetaTypeList' ) security.declareProtected(Permissions.AccessContentsInformation, 'getMetaTypeList' )
def getMetaTypeList(self): def getMetaTypeList(self):
meta_type_dict = {} meta_type_dict = {}
for file in self.getDocumentedObject().objectValues(): for file in self.getDocumentedObject().objectValues():
meta_type_dict[file.meta_type] = None meta_type_dict[file.meta_type] = None
type_list = meta_type_dict.keys() type_list = meta_type_dict.keys()
type_list.sort() type_list.sort()
...@@ -101,7 +101,7 @@ class SkinFolderDocumentationHelper(DocumentationHelper): ...@@ -101,7 +101,7 @@ class SkinFolderDocumentationHelper(DocumentationHelper):
files = self.getDocumentedObject() files = self.getDocumentedObject()
if files is not None: if files is not None:
for file in files.objectValues(): for file in files.objectValues():
if not meta_type or file.meta_type == meta_type: if not meta_type or file.meta_type == meta_type:
file_list.append((file.id, file.title, file.meta_type)) file_list.append((file.id, file.title, file.meta_type))
return file_list return file_list
......
...@@ -70,6 +70,5 @@ class SkinFolderItemDocumentationHelper(DocumentationHelper): ...@@ -70,6 +70,5 @@ class SkinFolderItemDocumentationHelper(DocumentationHelper):
""" """
return getattr(self.getDocumentedObject(), "content_type", '') return getattr(self.getDocumentedObject(), "content_type", '')
InitializeClass(SkinFolderItemDocumentationHelper) InitializeClass(SkinFolderItemDocumentationHelper)
...@@ -32,8 +32,8 @@ from Globals import InitializeClass ...@@ -32,8 +32,8 @@ from Globals import InitializeClass
from DocumentationHelper import DocumentationHelper from DocumentationHelper import DocumentationHelper
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
class ZSQLMethodDocumentationHelper(DocumentationHelper): class ZSQLMethodDocumentationHelper(DocumentationHelper):
""" """
Provides documentation about a Z SQL Method Provides documentation about a Z SQL Method
""" """
security = ClassSecurityInfo() security = ClassSecurityInfo()
......
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