Commit d5a12352 authored by Mayoro Diagne's avatar Mayoro Diagne

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21608 20353a03-c40f-0410-a6d1-a30d3c3de9de

parent 348e8bd5
...@@ -265,9 +265,9 @@ class DCWorkflowDocumentationHelper(DocumentationHelper): ...@@ -265,9 +265,9 @@ class DCWorkflowDocumentationHelper(DocumentationHelper):
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' )
...@@ -388,8 +388,8 @@ class DCWorkflowDocumentationHelper(DocumentationHelper): ...@@ -388,8 +388,8 @@ class DCWorkflowDocumentationHelper(DocumentationHelper):
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'
......
...@@ -121,7 +121,7 @@ class DCWorkflowTransitionDocumentationHelper(DocumentationHelper): ...@@ -121,7 +121,7 @@ class DCWorkflowTransitionDocumentationHelper(DocumentationHelper):
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)
......
...@@ -121,11 +121,11 @@ class DocumentationHelper(Implicit): ...@@ -121,11 +121,11 @@ class DocumentationHelper(Implicit):
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
......
...@@ -88,7 +88,7 @@ class ERP5SiteDocumentationHelper(DocumentationHelper): ...@@ -88,7 +88,7 @@ class ERP5SiteDocumentationHelper(DocumentationHelper):
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
...@@ -106,11 +106,11 @@ class ERP5SiteDocumentationHelper(DocumentationHelper): ...@@ -106,11 +106,11 @@ class ERP5SiteDocumentationHelper(DocumentationHelper):
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' )
......
...@@ -74,7 +74,7 @@ class PageTemplateDocumentationHelper(DocumentationHelper): ...@@ -74,7 +74,7 @@ class PageTemplateDocumentationHelper(DocumentationHelper):
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'
......
...@@ -78,7 +78,7 @@ class PortalTypePropertySheetDocumentationHelper(DocumentationHelper): ...@@ -78,7 +78,7 @@ class PortalTypePropertySheetDocumentationHelper(DocumentationHelper):
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 ScriptPythonDocumentationHelper(DocumentationHelper): ...@@ -73,7 +73,7 @@ class ScriptPythonDocumentationHelper(DocumentationHelper):
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'
......
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