Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mikolaï Krol
erp5
Commits
348e8bd5
Commit
348e8bd5
authored
Jun 16, 2008
by
Mayoro Diagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
69419bf4
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
388 additions
and
264 deletions
+388
-264
product/ERP5Type/DocumentationHelper/AccessorMethodDocumentationHelper.py
.../DocumentationHelper/AccessorMethodDocumentationHelper.py
+2
-3
product/ERP5Type/DocumentationHelper/BusinessTemplateDocumentationHelper.py
...ocumentationHelper/BusinessTemplateDocumentationHelper.py
+13
-11
product/ERP5Type/DocumentationHelper/CatalogMethodDocumentationHelper.py
...e/DocumentationHelper/CatalogMethodDocumentationHelper.py
+16
-6
product/ERP5Type/DocumentationHelper/DCWorkflowDocumentationHelper.py
...Type/DocumentationHelper/DCWorkflowDocumentationHelper.py
+80
-60
product/ERP5Type/DocumentationHelper/DCWorkflowPermissionDocumentationHelper.py
...entationHelper/DCWorkflowPermissionDocumentationHelper.py
+3
-4
product/ERP5Type/DocumentationHelper/DCWorkflowScriptDocumentationHelper.py
...ocumentationHelper/DCWorkflowScriptDocumentationHelper.py
+2
-2
product/ERP5Type/DocumentationHelper/DCWorkflowStateDocumentationHelper.py
...DocumentationHelper/DCWorkflowStateDocumentationHelper.py
+3
-5
product/ERP5Type/DocumentationHelper/DCWorkflowTransitionDocumentationHelper.py
...entationHelper/DCWorkflowTransitionDocumentationHelper.py
+8
-10
product/ERP5Type/DocumentationHelper/DCWorkflowVariableDocumentationHelper.py
...umentationHelper/DCWorkflowVariableDocumentationHelper.py
+4
-5
product/ERP5Type/DocumentationHelper/DCWorkflowWorklistDocumentationHelper.py
...umentationHelper/DCWorkflowWorklistDocumentationHelper.py
+2
-3
product/ERP5Type/DocumentationHelper/DocumentationHelper.py
product/ERP5Type/DocumentationHelper/DocumentationHelper.py
+63
-19
product/ERP5Type/DocumentationHelper/ERP5FormDocumentationHelper.py
...P5Type/DocumentationHelper/ERP5FormDocumentationHelper.py
+3
-3
product/ERP5Type/DocumentationHelper/ERP5SiteDocumentationHelper.py
...P5Type/DocumentationHelper/ERP5SiteDocumentationHelper.py
+15
-15
product/ERP5Type/DocumentationHelper/InteractionWorkflowDocumentationHelper.py
...mentationHelper/InteractionWorkflowDocumentationHelper.py
+75
-58
product/ERP5Type/DocumentationHelper/PageTemplateDocumentationHelper.py
...pe/DocumentationHelper/PageTemplateDocumentationHelper.py
+4
-3
product/ERP5Type/DocumentationHelper/PortalTypeActionDocumentationHelper.py
...ocumentationHelper/PortalTypeActionDocumentationHelper.py
+7
-7
product/ERP5Type/DocumentationHelper/PortalTypeDocumentationHelper.py
...Type/DocumentationHelper/PortalTypeDocumentationHelper.py
+44
-16
product/ERP5Type/DocumentationHelper/PortalTypePropertySheetDocumentationHelper.py
...ationHelper/PortalTypePropertySheetDocumentationHelper.py
+4
-3
product/ERP5Type/DocumentationHelper/PortalTypeRoleDocumentationHelper.py
.../DocumentationHelper/PortalTypeRoleDocumentationHelper.py
+4
-5
product/ERP5Type/DocumentationHelper/ScriptPythonDocumentationHelper.py
...pe/DocumentationHelper/ScriptPythonDocumentationHelper.py
+3
-3
product/ERP5Type/DocumentationHelper/SkinFolderDocumentationHelper.py
...Type/DocumentationHelper/SkinFolderDocumentationHelper.py
+19
-8
product/ERP5Type/DocumentationHelper/SkinFolderItemDocumentationHelper.py
.../DocumentationHelper/SkinFolderItemDocumentationHelper.py
+4
-4
product/ERP5Type/DocumentationHelper/WorkflowMethodDocumentationHelper.py
.../DocumentationHelper/WorkflowMethodDocumentationHelper.py
+2
-3
product/ERP5Type/DocumentationHelper/ZSQLMethodDocumentationHelper.py
...Type/DocumentationHelper/ZSQLMethodDocumentationHelper.py
+8
-8
No files found.
product/ERP5Type/DocumentationHelper/AccessorMethodDocumentationHelper.py
View file @
348e8bd5
...
...
@@ -78,7 +78,7 @@ class AccessorMethodDocumentationHelper(DocumentationHelper):
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getDescription'
)
def
getDescription
(
self
):
return
self
.
getDocumentedObject
().
__doc__
return
getattr
(
self
.
getDocumentedObject
(),
"__doc__"
,
""
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getType'
)
def
getType
(
self
):
...
...
@@ -86,14 +86,13 @@ class AccessorMethodDocumentationHelper(DocumentationHelper):
Returns the type of the documentation helper
"""
return
"Accessor Method"
#return self.getDocumentedObject().func_code.__module__
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTitle'
)
def
getTitle
(
self
):
"""
Returns the title of the documentation helper
"""
return
self
.
getDocumentedObject
().
__name__
return
getattr
(
self
.
getDocumentedObject
(),
"__name__"
,
""
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getSectionList'
)
def
getSectionList
(
self
):
...
...
product/ERP5Type/DocumentationHelper/BusinessTemplateDocumentationHelper.py
View file @
348e8bd5
...
...
@@ -49,7 +49,7 @@ class BusinessTemplateDocumentationHelper(DocumentationHelper):
"""
Returns the title of the documentation helper
"""
return
self
.
getDocumentedObject
().
title
return
getattr
(
self
.
getDocumentedObject
(),
'title'
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getType'
)
def
getType
(
self
):
...
...
@@ -114,21 +114,21 @@ class BusinessTemplateDocumentationHelper(DocumentationHelper):
"""
Returns the description of the documentation helper
"""
return
self
.
getDocumentedObject
().
description
return
getattr
(
self
.
getDocumentedObject
(),
'description'
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getVersion'
)
def
getVersion
(
self
):
"""
Returns the version of the business template
"""
return
self
.
getDocumentedObject
().
version
return
getattr
(
self
.
getDocumentedObject
(),
'version'
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getRevisionNumber'
)
def
getRevisionNumber
(
self
):
"""
Returns the revision number of the documentation helper
"""
return
self
.
getDocumentedObject
().
revision
return
getattr
(
self
.
getDocumentedObject
(),
'revision'
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getBuildingState'
)
def
getBuildingState
(
self
):
...
...
@@ -149,14 +149,15 @@ class BusinessTemplateDocumentationHelper(DocumentationHelper):
"""
Returns the list of maintainers of the business template
"""
return
self
.
getDocumentedObject
().
maintainer
return
getattr
(
self
.
getDocumentedObject
(),
'maintainer'
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getDependencyList'
)
def
getDependencyList
(
self
):
"""
Returns the list of dependencies of the business template
"""
return
self
.
getDocumentedObject
().
dependency
return
getattr
(
self
.
getDocumentedObject
(),
'dependency'
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getPortalTypeIdList'
)
def
getPortalTypeIdList
(
self
):
...
...
@@ -191,8 +192,8 @@ class BusinessTemplateDocumentationHelper(DocumentationHelper):
"""
"""
dc_workflow_list
=
[]
#for wf in self.getDocumentedObject().template_workflow_id:
for
wf
in
getattr
(
self
.
getDocumentedObject
(),
'template_workflow_id'
,
[])
:
template_workflow_id_list
=
getattr
(
self
.
getDocumentedObject
(),
'template_workflow_id'
,
[])
for
wf
in
template_workflow_id_list
:
url
=
'/'
+
self
.
getPortalObject
().
id
+
'/portal_workflow/'
+
wf
wf_object
=
self
.
getPortalObject
().
unrestrictedTraverse
(
url
)
if
wf_object
.
__class__
.
__name__
==
'DCWorkflowDefinition'
:
...
...
@@ -212,7 +213,8 @@ class BusinessTemplateDocumentationHelper(DocumentationHelper):
"""
"""
workflow_list
=
[]
for
wf
in
getattr
(
self
.
getDocumentedObject
(),
'template_workflow_id'
,
[]):
template_workflow_id_list
=
getattr
(
self
.
getDocumentedObject
(),
'template_workflow_id'
,
[])
for
wf
in
template_workflow_id_list
:
url
=
'/'
+
self
.
getPortalObject
().
id
+
'/portal_workflow/'
+
wf
wf_object
=
self
.
getPortalObject
().
unrestrictedTraverse
(
url
)
if
wf_object
.
__class__
.
__name__
==
'InteractionWorkflowDefinition'
:
...
...
@@ -231,9 +233,9 @@ class BusinessTemplateDocumentationHelper(DocumentationHelper):
def
getBaseCategoryList
(
self
):
"""
"""
return
getattr
(
self
.
getDocumentedObject
(),
'template_base_category'
,
[]
)
return
getattr
(
self
.
getDocumentedObject
(),
'template_base_category'
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'get
PortalType
URIList'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'get
BaseCategory
URIList'
)
def
getBaseCategoryURIList
(
self
):
"""
"""
...
...
product/ERP5Type/DocumentationHelper/CatalogMethodDocumentationHelper.py
View file @
348e8bd5
...
...
@@ -54,14 +54,14 @@ class CatalogMethodDocumentationHelper(DocumentationHelper):
"""
Returns the id of the documentation helper
"""
return
self
.
getDocumentedObject
().
id
return
getattr
(
self
.
getDocumentedObject
(),
'id'
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTitle'
)
def
getTitle
(
self
):
"""
Returns the title of the documentation helper
"""
return
self
.
getDocumentedObject
().
title
return
getattr
(
self
.
getDocumentedObject
(),
'title'
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getSource'
)
def
getSource
(
self
):
...
...
@@ -69,7 +69,7 @@ class CatalogMethodDocumentationHelper(DocumentationHelper):
Returns the source code of the documentation helper
"""
from
zLOG
import
LOG
,
INFO
source_code
=
self
.
getDocumentedObject
().
src
source_code
=
getattr
(
self
.
getDocumentedObject
(),
'src'
,
''
)
portal_transforms
=
getattr
(
self
,
'portal_transforms'
,
None
)
if
portal_transforms
is
None
:
LOG
(
'DCWorkflowScriptDocumentationHelper'
,
INFO
,
...
...
@@ -85,20 +85,30 @@ class CatalogMethodDocumentationHelper(DocumentationHelper):
"""
Returns the title of the documentation helper
"""
return
self
.
getDocumentedObject
().
connection_id
return
getattr
(
self
.
getDocumentedObject
(),
'connection_id'
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getArgumentList'
)
def
getArgumentList
(
self
):
"""
Returns the arguments of the documentation helper
"""
return
self
.
getDocumentedObject
().
_arg
.
_keys
#return self.getDocumentedObject()._arg._keys
keys
=
[]
arg
=
getattr
(
self
.
getDocumentedObject
(),
'_arg'
,
None
)
if
arg
is
not
None
:
keys
=
getattr
(
arg
,
'_keys'
,
[])
return
keys
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getCatalog'
)
def
getCatalog
(
self
):
"""
Returns the catalog name of the documentation helper
"""
return
self
.
getDocumentedObject
().
aq_parent
.
__name__
#return self.getDocumentedObject().aq_parent.__name__
catalog
=
''
parent
=
getattr
(
self
.
getDocumentedObject
(),
'aq_parent'
,
None
)
if
parent
is
not
None
:
catalog
=
getattr
(
parent
,
'__name__'
,
''
)
return
catalog
InitializeClass
(
CatalogMethodDocumentationHelper
)
product/ERP5Type/DocumentationHelper/DCWorkflowDocumentationHelper.py
View file @
348e8bd5
...
...
@@ -32,7 +32,6 @@ from Globals import InitializeClass
from
DocumentationHelper
import
DocumentationHelper
from
DocumentationSection
import
DocumentationSection
from
Products.ERP5Type
import
Permissions
from
zLOG
import
LOG
,
INFO
from
Products.DCWorkflowGraph.DCWorkflowGraph
import
getGraph
def
getStatePermissionsOfRole
(
state
=
None
,
role
=
''
):
...
...
@@ -76,7 +75,7 @@ class DCWorkflowDocumentationHelper(DocumentationHelper):
"""
Returns the Id of the documentation helper
"""
return
self
.
getInstance
().
__name__
return
getattr
(
self
.
getInstance
(),
'__name__'
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getType'
)
def
getType
(
self
):
...
...
@@ -90,15 +89,14 @@ class DCWorkflowDocumentationHelper(DocumentationHelper):
"""
Returns the title of the documentation helper
"""
return
self
.
getInstance
().
title
return
getattr
(
self
.
getInstance
(),
'title'
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getDescription'
)
def
getDescription
(
self
):
"""
Returns the description of the documentation helper
"""
#return self.getInstance().__dict__["description"]
return
self
.
getInstance
().
description
return
getattr
(
self
.
getInstance
(),
'description'
,
''
)
...
...
@@ -152,8 +150,10 @@ class DCWorkflowDocumentationHelper(DocumentationHelper):
"""
"""
state_list
=
[]
for
state
in
self
.
getInstance
().
states
.
objectValues
():
state_list
.
append
(
state
.
getId
())
states
=
getattr
(
self
.
getInstance
(),
'states'
,
None
)
if
states
is
not
None
:
for
state
in
states
.
objectValues
():
state_list
.
append
(
state
.
getId
())
return
state_list
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getStateItemList'
)
...
...
@@ -161,16 +161,18 @@ class DCWorkflowDocumentationHelper(DocumentationHelper):
"""
"""
state_list
=
[]
for
state
in
self
.
getInstance
().
states
.
objectValues
():
state_list
.
append
((
state
.
getId
(),
state
.
__dict__
[
"title"
],
getStatePermissionsOfRole
(
state
,
'Owner'
),
getStatePermissionsOfRole
(
state
,
'Assignor'
),
getStatePermissionsOfRole
(
state
,
'Assignee'
),
getStatePermissionsOfRole
(
state
,
'Associate'
),
getStatePermissionsOfRole
(
state
,
'Author'
),
getStatePermissionsOfRole
(
state
,
'Auditor'
)
))
states
=
getattr
(
self
.
getInstance
(),
'states'
,
None
)
if
states
is
not
None
:
for
state
in
states
.
objectValues
():
state_list
.
append
((
getattr
(
state
,
"id"
,
""
),
getattr
(
state
,
"title"
,
""
),
getStatePermissionsOfRole
(
state
,
'Owner'
),
getStatePermissionsOfRole
(
state
,
'Assignor'
),
getStatePermissionsOfRole
(
state
,
'Assignee'
),
getStatePermissionsOfRole
(
state
,
'Associate'
),
getStatePermissionsOfRole
(
state
,
'Author'
),
getStatePermissionsOfRole
(
state
,
'Auditor'
)
))
return
state_list
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getStateUriList'
)
...
...
@@ -197,8 +199,10 @@ class DCWorkflowDocumentationHelper(DocumentationHelper):
"""
"""
transition_list
=
[]
for
transition
in
self
.
getInstance
().
transitions
.
objectValues
():
transition_list
.
append
(
transition
.
getId
())
transitions
=
getattr
(
self
.
getInstance
(),
'transitions'
,
None
)
if
transitions
is
not
None
:
for
transition
in
transitions
.
objectValues
():
transition_list
.
append
(
transition
.
getId
())
return
transition_list
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTransitionItemList'
)
...
...
@@ -207,18 +211,20 @@ class DCWorkflowDocumentationHelper(DocumentationHelper):
"""
transition_list
=
[]
trigger_type_list
=
[
'Automatic'
,
'Initiated by user action'
,
'Initiated by WorkflowMethod'
]
for
transition
in
self
.
getInstance
().
transitions
.
objectValues
():
guard_roles
=
""
guard
=
dir
(
transition
.
guard
)
if
hasattr
(
transition
.
guard
,
'__dict__'
):
if
'roles'
in
transition
.
guard
.
__dict__
.
keys
():
guard_roles
=
', '
.
join
(
role
for
role
in
transition
.
guard
.
__dict__
[
'roles'
])
transition_list
.
append
((
transition
.
getId
(),
transition
.
title
,
trigger_type_list
[
transition
.
trigger_type
],
transition
.
__dict__
[
"description"
],
guard_roles
))
transitions
=
getattr
(
self
.
getInstance
(),
'transitions'
,
None
)
if
transitions
is
not
None
:
for
transition
in
self
.
getInstance
().
transitions
.
objectValues
():
guard_roles
=
""
guard
=
dir
(
transition
.
guard
)
if
hasattr
(
transition
.
guard
,
'__dict__'
):
if
'roles'
in
transition
.
guard
.
__dict__
.
keys
():
guard_roles
=
', '
.
join
(
role
for
role
in
transition
.
guard
.
__dict__
[
'roles'
])
transition_list
.
append
((
transition
.
getId
(),
getattr
(
transition
,
"title"
,
""
),
trigger_type_list
[
transition
.
trigger_type
],
getattr
(
transition
,
"description"
,
""
),
guard_roles
))
return
transition_list
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTransitionUriList'
)
...
...
@@ -244,8 +250,10 @@ class DCWorkflowDocumentationHelper(DocumentationHelper):
"""
"""
variable_list
=
[]
for
variable
in
self
.
getInstance
().
variables
.
objectValues
():
variable_list
.
append
(
variable
.
getId
())
variables
=
getattr
(
self
.
getInstance
(),
'variables'
,
None
)
if
variables
is
not
None
:
for
variable
in
variables
.
objectValues
():
variable_list
.
append
(
variable
.
getId
())
return
variable_list
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getVariableItemList'
)
...
...
@@ -253,8 +261,13 @@ class DCWorkflowDocumentationHelper(DocumentationHelper):
"""
"""
variable_list
=
[]
for
variable
in
self
.
getInstance
().
variables
.
objectValues
():
variable_list
.
append
((
variable
.
getId
(),
variable
.
title
,
variable
.
__dict__
.
get
(
"description"
,
''
)))
variables
=
getattr
(
self
.
getInstance
(),
'variables'
,
None
)
if
variables
is
not
None
:
for
variable
in
variables
.
objectValues
():
variable_list
.
append
((
variable
.
getId
(),
getattr
(
variable
,
"title"
,
""
),
getattr
(
variable
,
"description"
,
""
)
))
return
variable_list
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getVariableURIList'
)
...
...
@@ -280,8 +293,10 @@ class DCWorkflowDocumentationHelper(DocumentationHelper):
"""
"""
permission_list
=
[]
for
permission
in
self
.
getInstance
().
permissions
:
permission_list
.
append
(
permission
)
permissions
=
getattr
(
self
.
getInstance
(),
"permissions"
,
None
)
if
permissions
is
not
None
:
for
permission
in
permissions
:
permission_list
.
append
(
permission
)
return
permission_list
...
...
@@ -308,8 +323,10 @@ class DCWorkflowDocumentationHelper(DocumentationHelper):
"""
"""
worklist_list
=
[]
for
wl
in
self
.
getInstance
().
worklists
.
objectValues
():
worklist_list
.
append
(
wl
.
__name__
)
worklists
=
getattr
(
self
.
getInstance
(),
"worklists"
,
None
)
if
worklists
is
not
None
:
for
wl
in
worklists
.
objectValues
():
worklist_list
.
append
(
getattr
(
wl
,
"__name__"
,
''
))
return
worklist_list
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getWorklistItemList'
)
...
...
@@ -317,17 +334,19 @@ class DCWorkflowDocumentationHelper(DocumentationHelper):
"""
"""
worklist_list
=
[]
for
wl
in
self
.
getInstance
().
worklists
.
objectValues
():
guard_roles
=
""
guard
=
dir
(
wl
.
guard
)
if
wl
.
title
==
""
:
title
=
wl
.
actbox_name
else
:
title
=
wl
.
title
if
hasattr
(
wl
.
guard
,
'__dict__'
):
if
'roles'
in
wl
.
guard
.
__dict__
.
keys
():
guard_roles
=
', '
.
join
(
role
for
role
in
wl
.
guard
.
__dict__
[
'roles'
])
worklist_list
.
append
((
wl
.
__name__
,
title
,
wl
.
__dict__
[
"description"
],
guard_roles
))
worklists
=
getattr
(
self
.
getInstance
(),
"worklists"
,
None
)
if
worklists
is
not
None
:
for
wl
in
worklists
.
objectValues
():
guard_roles
=
""
guard
=
dir
(
wl
.
guard
)
if
wl
.
title
==
""
:
title
=
wl
.
actbox_name
else
:
title
=
wl
.
title
if
hasattr
(
wl
.
guard
,
'__dict__'
):
if
'roles'
in
wl
.
guard
.
__dict__
.
keys
():
guard_roles
=
', '
.
join
(
role
for
role
in
wl
.
guard
.
__dict__
[
'roles'
])
worklist_list
.
append
((
wl
.
__name__
,
title
,
wl
.
__dict__
[
"description"
],
guard_roles
))
return
worklist_list
...
...
@@ -354,8 +373,10 @@ class DCWorkflowDocumentationHelper(DocumentationHelper):
"""
"""
script_list
=
[]
for
script
in
self
.
getInstance
().
scripts
.
objectValues
():
script_list
.
append
(
script
.
__name__
)
scripts
=
getattr
(
self
.
getInstance
(),
"scripts"
,
None
)
if
scripts
is
not
None
:
for
script
in
scripts
.
objectValues
():
script_list
.
append
(
getattr
(
script
,
"__name__"
,
''
))
return
script_list
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getScriptItemList'
)
...
...
@@ -363,13 +384,12 @@ class DCWorkflowDocumentationHelper(DocumentationHelper):
"""
"""
script_list
=
[]
for
script
in
self
.
getInstance
().
scripts
.
objectValues
():
#guard_roles = ""
#guard = dir(script.guard)
#if hasattr(script.guard, '__dict__'):
# if 'roles' in script.guard.__dict__.keys():
# guard_roles = ', '.join(role for role in script.guard.__dict__['roles'])
script_list
.
append
((
script
.
__name__
,
script
.
title
))
scripts
=
getattr
(
self
.
getInstance
(),
"scripts"
,
None
)
if
scripts
is
not
None
:
for
script
in
scripts
.
objectValues
():
script_list
.
append
((
getattr
(
script
,
"__name__"
,
''
),
getattr
(
script
,
"title"
,
''
)
))
return
script_list
...
...
@@ -404,6 +424,6 @@ class DCWorkflowDocumentationHelper(DocumentationHelper):
"""
Returns the graphic representation of the workflow as a PNG file
"""
return
getGraph
(
self
,
wf_id
=
self
.
getInstance
().
__name__
,
format
=
format
)
return
getGraph
(
self
,
wf_id
=
getattr
(
self
.
getInstance
(),
"__name__"
,
''
)
,
format
=
format
)
InitializeClass
(
DCWorkflowDocumentationHelper
)
product/ERP5Type/DocumentationHelper/DCWorkflowPermissionDocumentationHelper.py
View file @
348e8bd5
...
...
@@ -31,7 +31,6 @@ 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
):
"""
...
...
@@ -45,7 +44,7 @@ class DCWorkflowPermissionDocumentationHelper(DocumentationHelper):
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
):
...
...
@@ -59,14 +58,14 @@ class DCWorkflowPermissionDocumentationHelper(DocumentationHelper):
"""
Returns the id of the documentation helper
"""
return
""
#self.getDocumentedObject().__name__
return
getattr
(
self
.
getDocumentedObject
(),
"__name__"
,
""
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTitle'
)
def
getTitle
(
self
):
"""
Returns the title of the documentation helper
"""
return
""
#self.getDocumentedObject().title
return
getattr
(
self
.
getDocumentedObject
(),
"title"
,
""
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getSectionList'
)
def
getSectionList
(
self
):
...
...
product/ERP5Type/DocumentationHelper/DCWorkflowScriptDocumentationHelper.py
View file @
348e8bd5
...
...
@@ -55,7 +55,7 @@ class DCWorkflowScriptDocumentationHelper(DocumentationHelper):
"""
Returns the id of the documentation helper
"""
return
self
.
getDocumentedObject
().
__name__
return
getattr
(
self
.
getDocumentedObject
(),
"__name__"
,
""
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTitle'
)
...
...
@@ -63,7 +63,7 @@ class DCWorkflowScriptDocumentationHelper(DocumentationHelper):
"""
Returns the title of the documentation helper
"""
return
self
.
getDocumentedObject
().
title
return
getattr
(
self
.
getDocumentedObject
(),
"title"
,
""
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getSectionList'
)
def
getSectionList
(
self
):
...
...
product/ERP5Type/DocumentationHelper/DCWorkflowStateDocumentationHelper.py
View file @
348e8bd5
...
...
@@ -31,7 +31,6 @@ from AccessControl import ClassSecurityInfo
from
Globals
import
InitializeClass
from
DocumentationHelper
import
DocumentationHelper
from
Products.ERP5Type
import
Permissions
from
zLOG
import
LOG
,
INFO
def
getPermissionsOfRole
(
state
=
None
,
role
=
''
):
"""
...
...
@@ -41,7 +40,6 @@ def getPermissionsOfRole(state=None, role=''):
M = Modify Portal Content
C = Add Portal Content
"""
#LOG('yoooo', INFO, 'state=%s role=%s ' % (state, role))
permissions
=
""
if
state
!=
None
:
if
hasattr
(
state
,
'__dict__'
):
...
...
@@ -87,7 +85,7 @@ class DCWorkflowStateDocumentationHelper(DocumentationHelper):
"""
Returns the id of the documentation helper
"""
return
self
.
getDocumentedObject
().
__name__
return
getattr
(
self
.
getDocumentedObject
(),
"__name__"
,
""
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTitle'
)
...
...
@@ -95,7 +93,7 @@ class DCWorkflowStateDocumentationHelper(DocumentationHelper):
"""
Returns the title of the documentation helper
"""
return
self
.
getDocumentedObject
().
__dict__
[
"title"
]
return
getattr
(
self
.
getDocumentedObject
(),
"title"
,
""
)
def
getSectionList
(
self
):
"""
...
...
@@ -108,7 +106,7 @@ class DCWorkflowStateDocumentationHelper(DocumentationHelper):
"""
Returns list of possible transitions from this state
"""
return
self
.
getDocumentedObject
().
transitions
return
getattr
(
self
.
getDocumentedObject
(),
"transitions"
,
[])
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getPermissionsOfRoleOwner'
)
def
getPermissionsOfRoleOwner
(
self
):
...
...
product/ERP5Type/DocumentationHelper/DCWorkflowTransitionDocumentationHelper.py
View file @
348e8bd5
...
...
@@ -31,7 +31,6 @@ from AccessControl import ClassSecurityInfo
from
Globals
import
InitializeClass
from
DocumentationHelper
import
DocumentationHelper
from
Products.ERP5Type
import
Permissions
from
zLOG
import
LOG
,
INFO
class
DCWorkflowTransitionDocumentationHelper
(
DocumentationHelper
):
"""
...
...
@@ -45,7 +44,8 @@ class DCWorkflowTransitionDocumentationHelper(DocumentationHelper):
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getDescription'
)
def
getDescription
(
self
):
return
self
.
getDocumentedObject
().
__dict__
[
"description"
]
#return self.getDocumentedObject().__dict__["description"]
return
getattr
(
self
.
getDocumentedObject
(),
"description"
,
""
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getType'
)
def
getType
(
self
):
...
...
@@ -59,14 +59,14 @@ class DCWorkflowTransitionDocumentationHelper(DocumentationHelper):
"""
Returns the id of the documentation helper
"""
return
self
.
getDocumentedObject
().
__name__
return
getattr
(
self
.
getDocumentedObject
(),
"__name__"
,
""
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTitle'
)
def
getTitle
(
self
):
"""
Returns the title of the documentation helper
"""
return
self
.
getDocumentedObject
().
title
return
getattr
(
self
.
getDocumentedObject
(),
"title"
,
""
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getSectionList'
)
def
getSectionList
(
self
):
...
...
@@ -80,7 +80,7 @@ class DCWorkflowTransitionDocumentationHelper(DocumentationHelper):
"""
Returns the id of the new state for de workflow transition
"""
return
self
.
getDocumentedObject
().
new_state_id
return
getattr
(
self
.
getDocumentedObject
(),
"new_state_id"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTriggerType'
)
def
getTriggerType
(
self
):
...
...
@@ -88,7 +88,7 @@ class DCWorkflowTransitionDocumentationHelper(DocumentationHelper):
Returns the trigger type for de workflow transition
"""
trigger_type_list
=
[
'Automatic'
,
'Initiated by user action'
,
'Initiated by WorkflowMethod'
]
trigger_type_id
=
self
.
getDocumentedObject
().
trigger_type
trigger_type_id
=
getattr
(
self
.
getDocumentedObject
(),
"trigger_type"
,
''
)
return
trigger_type_list
[
trigger_type_id
]
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getScriptName'
)
...
...
@@ -96,14 +96,14 @@ class DCWorkflowTransitionDocumentationHelper(DocumentationHelper):
"""
Returns the name of the script for de workflow transition
"""
return
self
.
getDocumentedObject
().
script_name
return
getattr
(
self
.
getDocumentedObject
(),
"script_name"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getAfterScriptName'
)
def
getAfterScriptName
(
self
):
"""
Returns the name of the script for de workflow transition
"""
return
self
.
getDocumentedObject
().
after_script_name
return
getattr
(
self
.
getDocumentedObject
(),
"after_script_name"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getAvailableStateIds'
)
def
getAvailableStateIds
(
self
):
...
...
@@ -121,8 +121,6 @@ class DCWorkflowTransitionDocumentationHelper(DocumentationHelper):
if
hasattr
(
self
.
getDocumentedObject
(),
'guard'
):
dir
(
self
.
getDocumentedObject
().
guard
)
if
hasattr
(
self
.
getDocumentedObject
().
guard
,
'__dict__'
):
#LOG('baye... 3', INFO, 'dict=%s' % dir(self.getDocumentedObject().guard.__dict__))
#self.getDocumentedObject().guard.__dict__
if
'roles'
in
self
.
getDocumentedObject
().
guard
.
__dict__
.
keys
():
role_list
=
self
.
getDocumentedObject
().
guard
.
__dict__
[
'roles'
]
return
', '
.
join
(
role
for
role
in
role_list
)
...
...
product/ERP5Type/DocumentationHelper/DCWorkflowVariableDocumentationHelper.py
View file @
348e8bd5
...
...
@@ -31,7 +31,6 @@ from AccessControl import ClassSecurityInfo
from
Globals
import
InitializeClass
from
DocumentationHelper
import
DocumentationHelper
from
Products.ERP5Type
import
Permissions
from
zLOG
import
LOG
,
INFO
class
DCWorkflowVariableDocumentationHelper
(
DocumentationHelper
):
"""
...
...
@@ -45,7 +44,7 @@ class DCWorkflowVariableDocumentationHelper(DocumentationHelper):
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
):
...
...
@@ -59,7 +58,7 @@ class DCWorkflowVariableDocumentationHelper(DocumentationHelper):
"""
Returns the id of the documentation helper
"""
return
self
.
getDocumentedObject
().
__name__
return
getattr
(
self
.
getDocumentedObject
(),
"__name__"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getSectionList'
)
def
getSectionList
(
self
):
...
...
@@ -73,7 +72,7 @@ class DCWorkflowVariableDocumentationHelper(DocumentationHelper):
"""
Returns the title of the documentation helper
"""
return
self
.
getDocumentedObject
().
title
return
getattr
(
self
.
getDocumentedObject
(),
"title"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getDefaultExpression'
)
def
getDefaultExpression
(
self
):
...
...
@@ -81,7 +80,7 @@ class DCWorkflowVariableDocumentationHelper(DocumentationHelper):
Returns the Default Expression of the documentation helper
"""
default_expr
=
""
if
self
.
getDocumentedObject
().
default_expr
!=
None
:
if
getattr
(
self
.
getDocumentedObject
(),
"default_expr"
,
None
)
is
not
None
:
default_expr
=
self
.
getDocumentedObject
().
default_expr
.
text
return
default_expr
...
...
product/ERP5Type/DocumentationHelper/DCWorkflowWorklistDocumentationHelper.py
View file @
348e8bd5
...
...
@@ -31,7 +31,6 @@ from AccessControl import ClassSecurityInfo
from
Globals
import
InitializeClass
from
DocumentationHelper
import
DocumentationHelper
from
Products.ERP5Type
import
Permissions
from
zLOG
import
LOG
,
INFO
class
DCWorkflowWorklistDocumentationHelper
(
DocumentationHelper
):
"""
...
...
@@ -45,7 +44,7 @@ class DCWorkflowWorklistDocumentationHelper(DocumentationHelper):
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
):
...
...
@@ -59,7 +58,7 @@ class DCWorkflowWorklistDocumentationHelper(DocumentationHelper):
"""
Returns the id of the documentation helper
"""
return
self
.
getDocumentedObject
().
__name__
return
getattr
(
self
.
getDocumentedObject
(),
"__name__"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getSectionList'
)
def
getSectionList
(
self
):
...
...
product/ERP5Type/DocumentationHelper/DocumentationHelper.py
View file @
348e8bd5
...
...
@@ -31,8 +31,43 @@ from AccessControl import ClassSecurityInfo
from
Globals
import
InitializeClass
from
Products.ERP5Type
import
Permissions
from
App.config
import
getConfiguration
from
zLOG
import
LOG
,
INFO
import
os
import
random
class
TempObjectLibrary
(
object
):
"""Create temporary objets of any portal type.
The purpose of this class is to deal with the fact that a portal type may
filter content types. For each requested portal type, this class creates the
required tree of temporary objects.
All created objects are cached.
"""
def
__init__
(
self
,
container
):
# Folder objects doesn't filter content types.
# Objects are created in a folder when there is no other choice.
self
.
root
=
container
.
newContent
(
portal_type
=
'Folder'
,
temp_object
=
1
)
self
.
portal_type_dict
=
{}
self
.
dependency_dict
=
{}
for
type_info
in
container
.
_getTypesTool
().
listTypeInfo
():
for
allowed
in
type_info
.
allowed_content_types
:
if
allowed
!=
type_info
.
id
:
self
.
dependency_dict
.
setdefault
(
allowed
,
[]).
append
(
type_info
.
id
)
def
__call__
(
self
,
portal_type
):
"""Returns a temporary instance of the given portal_type."""
temp_object
=
self
.
portal_type_dict
.
get
(
portal_type
)
if
temp_object
is
None
:
possible_parent_list
=
self
.
dependency_dict
.
get
(
portal_type
)
if
possible_parent_list
:
# Note that the dependency graph may contain cycles,
# so we use the most simple pathfinding algorithm: random.
container
=
self
(
random
.
choice
(
possible_parent_list
))
else
:
container
=
self
.
root
temp_object
=
container
.
newContent
(
portal_type
=
portal_type
,
temp_object
=
1
)
self
.
portal_type_dict
[
portal_type
]
=
temp_object
return
temp_object
class
DocumentationHelper
(
Implicit
):
"""
...
...
@@ -56,12 +91,22 @@ class DocumentationHelper(Implicit):
def
__init__
(
self
,
uri
):
self
.
uri
=
uri
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTempInstance'
)
def
getTempInstance
(
self
,
portal_type
):
"""
Returns a temporary instance of the given portal_type
"""
self
.
getTempInstance
=
TempObjectLibrary
(
self
.
getPortalObject
().
portal_classes
)
return
self
.
getTempInstance
(
portal_type
)
def
getDocumentedObject
(
self
):
if
self
.
uri
.
startswith
(
'portal_classes/temp_instance'
):
url
,
method
=
self
.
uri
.
split
(
'#'
)
portal_type
=
url
.
split
(
'/'
)[
-
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
)
url
,
method
=
self
.
uri
.
split
(
'#'
)
portal_type
=
url
.
split
(
'/'
)[
-
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)
self
.
getTempInstance
=
TempObjectLibrary
(
self
.
getPortalObject
().
portal_classes
)
temp_object
=
self
.
getTempInstance
(
portal_type
)
if
'/'
not
in
method
:
documented_object
=
getattr
(
temp_object
,
method
,
None
)
else
:
...
...
@@ -76,11 +121,11 @@ class DocumentationHelper(Implicit):
zope_property_sheet
=
instance_home
+
'/PropertySheet'
list_propertysheets
=
[
zope_property_sheet
,]
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'
):
list_propertysheets
.
append
(
full_path
+
'/PropertySheet'
)
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
documented_object
=
open
(
file_url
)
elif
'/'
in
self
.
uri
and
'#'
not
in
self
.
uri
:
...
...
@@ -89,20 +134,20 @@ class DocumentationHelper(Implicit):
try
:
documented_object
=
self
.
getPortalObject
().
portal_categories
.
resolveCategory
(
self
.
uri
)
except
:
documented_object
=
None
documented_object
=
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
:
if
'?'
in
self
.
uri
:
base_url
,
url
=
self
.
uri
.
split
(
'?'
)
type
,
name
=
url
.
split
(
'#'
)
parent_object
=
self
.
getPortalObject
().
unrestrictedTraverse
(
base_url
)
object_list
=
getattr
(
parent_object
,
type
,
None
)
documented_object
=
None
if
object_list
is
not
None
:
base_url
,
url
=
self
.
uri
.
split
(
'?'
)
type
,
name
=
url
.
split
(
'#'
)
parent_object
=
self
.
getPortalObject
().
unrestrictedTraverse
(
base_url
)
object_list
=
getattr
(
parent_object
,
type
,
None
)
documented_object
=
None
if
object_list
is
not
None
:
for
obj
in
object_list
:
if
obj
.
__name__
==
name
:
documented_object
=
obj
if
obj
.
__name__
==
name
:
documented_object
=
obj
else
:
url
,
method
=
self
.
uri
.
split
(
'#'
)
documented_object
=
self
.
getPortalObject
().
unrestrictedTraverse
(
url
)
...
...
@@ -124,10 +169,9 @@ class DocumentationHelper(Implicit):
import
Products
documented_object
=
Products
for
key
in
module_list
[
1
:]:
#LOG('Baye, loop in module_list', 0,'do=%s et uri=%s' % (repr(documented_object), self.uri))
documented_object
=
getattr
(
documented_object
,
key
)
else
:
raise
NotImplemented
raise
NotImplemented
#fp, pathname, description = imp.find_module(base_module)
#documented_object = imp.load_module(fp, pathname, description)
return
documented_object
...
...
product/ERP5Type/DocumentationHelper/ERP5FormDocumentationHelper.py
View file @
348e8bd5
...
...
@@ -54,20 +54,20 @@ class ERP5FormDocumentationHelper(DocumentationHelper):
"""
Returns the id of the documentation helper
"""
return
self
.
getDocumentedObject
().
id
return
getattr
(
self
.
getDocumentedObject
(),
"id"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTitle'
)
def
getTitle
(
self
):
"""
Returns the title of the documentation helper
"""
return
self
.
getDocumentedObject
().
title
return
getattr
(
self
.
getDocumentedObject
(),
"title"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getEncoding'
)
def
getEncoding
(
self
):
"""
Returns the encoding of the ERP5 Form
"""
return
self
.
getDocumentedObject
().
encoding
return
getattr
(
self
.
getDocumentedObject
(),
"encoding"
,
''
)
InitializeClass
(
ERP5FormDocumentationHelper
)
product/ERP5Type/DocumentationHelper/ERP5SiteDocumentationHelper.py
View file @
348e8bd5
...
...
@@ -33,7 +33,6 @@ from Globals import InitializeClass
from
DocumentationHelper
import
DocumentationHelper
from
DocumentationSection
import
DocumentationSection
from
Products.ERP5Type
import
Permissions
from
zLOG
import
LOG
,
INFO
class
ERP5SiteDocumentationHelper
(
DocumentationHelper
):
"""
...
...
@@ -50,7 +49,7 @@ class ERP5SiteDocumentationHelper(DocumentationHelper):
"""
Returns the title of the documentation helper
"""
return
self
.
getDocumentedObject
().
title
return
getattr
(
self
.
getDocumentedObject
(),
"title"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getType'
)
def
getType
(
self
):
...
...
@@ -79,7 +78,7 @@ class ERP5SiteDocumentationHelper(DocumentationHelper):
"""
Returns the description of the documentation helper
"""
return
self
.
getDocumentedObject
().
description
return
getattr
(
self
.
getDocumentedObject
(),
"description"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getBusinessTemplateIdList'
)
def
getBusinessTemplateIdList
(
self
):
...
...
@@ -99,18 +98,19 @@ class ERP5SiteDocumentationHelper(DocumentationHelper):
"""
"""
bt_list
=
[]
for
bt
in
self
.
getDocumentedObject
().
portal_templates
.
objectValues
():
revision
=
""
version
=
""
if
hasattr
(
bt
,
'revision'
):
revision
=
bt
.
revision
if
hasattr
(
bt
,
'version'
):
version
=
bt
.
version
current_state
=
''
for
wh
in
bt
.
workflow_history
[
'business_template_installation_workflow'
]:
current_state
=
wh
[
'installation_state'
]
if
current_state
==
'installed'
:
bt_list
.
append
((
bt
.
getId
(),
bt
.
title
,
bt
.
description
,
version
,
revision
))
portal_templates
=
getattr
(
self
.
getDocumentedObject
(),
"portal_templates"
,
None
)
if
portal_templates
is
not
None
:
for
bt
in
portal_templates
.
objectValues
():
current_state
=
''
for
wh
in
bt
.
workflow_history
[
'business_template_installation_workflow'
]:
current_state
=
wh
[
'installation_state'
]
if
current_state
==
'installed'
:
bt_list
.
append
((
bt
.
getId
(),
getattr
(
bt
,
"title"
,
''
),
getattr
(
bt
,
"description"
,
''
),
getattr
(
bt
,
"version"
,
''
),
getattr
(
bt
,
"revision"
,
''
)
))
return
bt_list
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getBusinessTemplateURIList'
)
...
...
product/ERP5Type/DocumentationHelper/InteractionWorkflowDocumentationHelper.py
View file @
348e8bd5
...
...
@@ -32,7 +32,6 @@ from Globals import InitializeClass
from
DocumentationHelper
import
DocumentationHelper
from
DocumentationSection
import
DocumentationSection
from
Products.ERP5Type
import
Permissions
from
zLOG
import
LOG
,
INFO
from
Products.DCWorkflowGraph.DCWorkflowGraph
import
getGraph
def
getStatePermissionsOfRole
(
state
=
None
,
role
=
''
):
...
...
@@ -76,7 +75,8 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper):
"""
Returns the Id of the documentation helper
"""
return
self
.
getInstance
().
__name__
return
getattr
(
self
.
getInstance
(),
"__name__"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getType'
)
def
getType
(
self
):
...
...
@@ -90,14 +90,14 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper):
"""
Returns the title of the documentation helper
"""
return
self
.
getInstance
().
title
return
getattr
(
self
.
getInstance
(),
"title"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getDescription'
)
def
getDescription
(
self
):
"""
Returns the description of the documentation helper
"""
return
self
.
getInstance
().
description
return
getattr
(
self
.
getInstance
(),
"description"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getSectionList'
)
...
...
@@ -150,8 +150,10 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper):
"""
"""
state_list
=
[]
for
state
in
self
.
getInstance
().
states
.
objectValues
():
state_list
.
append
(
state
.
getId
())
if
hasattr
(
self
.
getInstance
(),
"states"
):
if
self
.
getInstance
().
states
is
not
None
:
for
state
in
self
.
getInstance
().
states
.
objectValues
():
state_list
.
append
(
state
.
getId
())
return
state_list
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getStateItemList'
)
...
...
@@ -159,16 +161,18 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper):
"""
"""
state_list
=
[]
for
state
in
self
.
getInstance
().
states
.
objectValues
():
state_list
.
append
((
state
.
getId
(),
state
.
__dict__
[
"title"
],
getStatePermissionsOfRole
(
state
,
'Owner'
),
getStatePermissionsOfRole
(
state
,
'Assignor'
),
getStatePermissionsOfRole
(
state
,
'Assignee'
),
getStatePermissionsOfRole
(
state
,
'Associate'
),
getStatePermissionsOfRole
(
state
,
'Author'
),
getStatePermissionsOfRole
(
state
,
'Auditor'
)
))
if
hasattr
(
self
.
getInstance
(),
"states"
):
if
self
.
getInstance
().
states
is
not
None
:
for
state
in
self
.
getInstance
().
states
.
objectValues
():
state_list
.
append
((
state
.
getId
(),
state
.
__dict__
[
"title"
],
getStatePermissionsOfRole
(
state
,
'Owner'
),
getStatePermissionsOfRole
(
state
,
'Assignor'
),
getStatePermissionsOfRole
(
state
,
'Assignee'
),
getStatePermissionsOfRole
(
state
,
'Associate'
),
getStatePermissionsOfRole
(
state
,
'Author'
),
getStatePermissionsOfRole
(
state
,
'Auditor'
)
))
return
state_list
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getStateUriList'
)
...
...
@@ -195,8 +199,10 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper):
"""
"""
transition_list
=
[]
for
transition
in
self
.
getInstance
().
transitions
.
objectValues
():
transition_list
.
append
(
transition
.
getId
())
if
hasattr
(
self
.
getInstance
(),
"transitions"
):
if
self
.
getInstance
().
transitions
is
not
None
:
for
transition
in
self
.
getInstance
().
transitions
.
objectValues
():
transition_list
.
append
(
transition
.
getId
())
return
transition_list
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTransitionItemList'
)
...
...
@@ -205,18 +211,20 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper):
"""
transition_list
=
[]
trigger_type_list
=
[
'Automatic'
,
'Initiated by user action'
,
'Initiated by WorkflowMethod'
]
for
transition
in
self
.
getInstance
().
transitions
.
objectValues
():
guard_roles
=
""
guard
=
dir
(
transition
.
guard
)
if
hasattr
(
transition
.
guard
,
'__dict__'
):
if
'roles'
in
transition
.
guard
.
__dict__
.
keys
():
guard_roles
=
', '
.
join
(
role
for
role
in
transition
.
guard
.
__dict__
[
'roles'
])
transition_list
.
append
((
transition
.
getId
(),
transition
.
title
,
trigger_type_list
[
transition
.
trigger_type
],
transition
.
__dict__
[
"description"
],
guard_roles
))
if
hasattr
(
self
.
getInstance
(),
"transitions"
):
if
self
.
getInstance
().
transitions
is
not
None
:
for
transition
in
self
.
getInstance
().
transitions
.
objectValues
():
guard_roles
=
""
guard
=
dir
(
transition
.
guard
)
if
hasattr
(
transition
.
guard
,
'__dict__'
):
if
'roles'
in
transition
.
guard
.
__dict__
.
keys
():
guard_roles
=
', '
.
join
(
role
for
role
in
transition
.
guard
.
__dict__
[
'roles'
])
transition_list
.
append
((
transition
.
getId
(),
transition
.
title
,
trigger_type_list
[
transition
.
trigger_type
],
transition
.
__dict__
[
"description"
],
guard_roles
))
return
transition_list
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTransitionUriList'
)
...
...
@@ -242,8 +250,10 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper):
"""
"""
variable_list
=
[]
for
variable
in
self
.
getInstance
().
variables
.
objectValues
():
variable_list
.
append
(
variable
.
getId
())
if
hasattr
(
self
.
getInstance
(),
"variables"
):
if
self
.
getInstance
().
variables
is
not
None
:
for
variable
in
self
.
getInstance
().
variables
.
objectValues
():
variable_list
.
append
(
variable
.
getId
())
return
variable_list
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getVariableItemList'
)
...
...
@@ -251,8 +261,10 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper):
"""
"""
variable_list
=
[]
for
variable
in
self
.
getInstance
().
variables
.
objectValues
():
variable_list
.
append
((
variable
.
getId
(),
variable
.
title
,
variable
.
__dict__
[
"description"
]))
if
hasattr
(
self
.
getInstance
(),
"variables"
):
if
self
.
getInstance
().
variables
is
not
None
:
for
variable
in
self
.
getInstance
().
variables
.
objectValues
():
variable_list
.
append
((
variable
.
getId
(),
variable
.
title
,
variable
.
__dict__
[
"description"
]))
return
variable_list
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getVariableURIList'
)
...
...
@@ -278,8 +290,10 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper):
"""
"""
permission_list
=
[]
for
permission
in
self
.
getInstance
().
permissions
:
permission_list
.
append
(
permission
)
if
hasattr
(
self
.
getInstance
(),
"permissions"
):
if
self
.
getInstance
().
permissions
is
not
None
:
for
permission
in
self
.
getInstance
().
permissions
:
permission_list
.
append
(
permission
)
return
permission_list
...
...
@@ -306,8 +320,10 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper):
"""
"""
worklist_list
=
[]
for
wl
in
self
.
getInstance
().
worklists
.
objectValues
():
worklist_list
.
append
(
wl
.
__name__
)
if
hasattr
(
self
.
getInstance
(),
"worklists"
):
if
self
.
getInstance
().
worklists
is
not
None
:
for
wl
in
self
.
getInstance
().
worklists
.
objectValues
():
worklist_list
.
append
(
wl
.
__name__
)
return
worklist_list
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getWorklistItemList'
)
...
...
@@ -315,17 +331,19 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper):
"""
"""
worklist_list
=
[]
for
wl
in
self
.
getInstance
().
worklists
.
objectValues
():
guard_roles
=
""
guard
=
dir
(
wl
.
guard
)
if
wl
.
title
==
""
:
title
=
wl
.
actbox_name
else
:
title
=
wl
.
title
if
hasattr
(
wl
.
guard
,
'__dict__'
):
if
'roles'
in
wl
.
guard
.
__dict__
.
keys
():
guard_roles
=
', '
.
join
(
role
for
role
in
wl
.
guard
.
__dict__
[
'roles'
])
worklist_list
.
append
((
wl
.
__name__
,
title
,
wl
.
__dict__
[
"description"
],
guard_roles
))
if
hasattr
(
self
.
getInstance
(),
"worklists"
):
if
self
.
getInstance
().
worklists
is
not
None
:
for
wl
in
self
.
getInstance
().
worklists
.
objectValues
():
guard_roles
=
""
guard
=
dir
(
wl
.
guard
)
if
wl
.
title
==
""
:
title
=
wl
.
actbox_name
else
:
title
=
wl
.
title
if
hasattr
(
wl
.
guard
,
'__dict__'
):
if
'roles'
in
wl
.
guard
.
__dict__
.
keys
():
guard_roles
=
', '
.
join
(
role
for
role
in
wl
.
guard
.
__dict__
[
'roles'
])
worklist_list
.
append
((
wl
.
__name__
,
title
,
wl
.
__dict__
[
"description"
],
guard_roles
))
return
worklist_list
...
...
@@ -352,8 +370,10 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper):
"""
"""
script_list
=
[]
for
script
in
self
.
getInstance
().
scripts
.
objectValues
():
script_list
.
append
(
script
.
__name__
)
if
hasattr
(
self
.
getInstance
(),
"scripts"
):
if
self
.
getInstance
().
scripts
is
not
None
:
for
script
in
self
.
getInstance
().
scripts
.
objectValues
():
script_list
.
append
(
script
.
__name__
)
return
script_list
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getScriptItemList'
)
...
...
@@ -361,13 +381,10 @@ class InteractionWorkflowDocumentationHelper(DocumentationHelper):
"""
"""
script_list
=
[]
for
script
in
self
.
getInstance
().
scripts
.
objectValues
():
#guard_roles = ""
#guard = dir(script.guard)
#if hasattr(script.guard, '__dict__'):
# if 'roles' in script.guard.__dict__.keys():
# guard_roles = ', '.join(role for role in script.guard.__dict__['roles'])
script_list
.
append
((
script
.
__name__
,
script
.
title
))
if
hasattr
(
self
.
getInstance
(),
"scripts"
):
if
self
.
getInstance
().
scripts
is
not
None
:
for
script
in
self
.
getInstance
().
scripts
.
objectValues
():
script_list
.
append
((
script
.
__name__
,
script
.
title
))
return
script_list
...
...
product/ERP5Type/DocumentationHelper/PageTemplateDocumentationHelper.py
View file @
348e8bd5
...
...
@@ -54,14 +54,15 @@ class PageTemplateDocumentationHelper(DocumentationHelper):
"""
Returns the id of the documentation helper
"""
return
self
.
getDocumentedObject
().
id
return
getattr
(
self
.
getDocumentedObject
(),
"id"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTitle'
)
def
getTitle
(
self
):
"""
Returns the title of the documentation helper
"""
return
self
.
getDocumentedObject
().
title
return
getattr
(
self
.
getDocumentedObject
(),
"title"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getSourceCode'
)
def
getSourceCode
(
self
):
...
...
@@ -69,7 +70,7 @@ class PageTemplateDocumentationHelper(DocumentationHelper):
Returns the source code the script python
"""
from
zLOG
import
LOG
,
INFO
source_code
=
self
.
getDocumentedObject
().
_text
source_code
=
getattr
(
self
.
getDocumentedObject
(),
"_text"
,
''
)
portal_transforms
=
getattr
(
self
,
'portal_transforms'
,
None
)
if
portal_transforms
is
None
:
LOG
(
'DCWorkflowScriptDocumentationHelper'
,
INFO
,
...
...
product/ERP5Type/DocumentationHelper/PortalTypeActionDocumentationHelper.py
View file @
348e8bd5
...
...
@@ -31,7 +31,6 @@ from AccessControl import ClassSecurityInfo
from
Globals
import
InitializeClass
from
DocumentationHelper
import
DocumentationHelper
from
Products.ERP5Type
import
Permissions
from
zLOG
import
LOG
,
INFO
class
PortalTypeActionDocumentationHelper
(
DocumentationHelper
):
"""
...
...
@@ -45,7 +44,7 @@ class PortalTypeActionDocumentationHelper(DocumentationHelper):
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getDescription'
)
def
getDescription
(
self
):
return
self
.
getDocumentedObject
().
Description
(
)
return
getattr
(
self
.
getDocumentedObject
(),
"description"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getType'
)
def
getType
(
self
):
...
...
@@ -59,7 +58,7 @@ class PortalTypeActionDocumentationHelper(DocumentationHelper):
"""
Returns the id of the documentation helper
"""
return
self
.
getDocumentedObject
().
__name__
return
getattr
(
self
.
getDocumentedObject
(),
"__name__"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getSectionList'
)
def
getSectionList
(
self
):
...
...
@@ -73,14 +72,15 @@ class PortalTypeActionDocumentationHelper(DocumentationHelper):
"""
Returns the title of the documentation helper
"""
return
self
.
getDocumentedObject
().
title
return
getattr
(
self
.
getDocumentedObject
(),
"title"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getPermissions'
)
def
getPermissions
(
self
):
"""
Returns the permissions of the documentation helper
"""
return
', '
.
join
(
x
for
x
in
self
.
getDocumentedObject
().
permissions
)
permissions
=
getattr
(
self
.
getDocumentedObject
(),
"permissions"
,
[])
return
', '
.
join
(
x
for
x
in
permissions
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getVisible'
)
def
getVisible
(
self
):
...
...
@@ -88,13 +88,13 @@ class PortalTypeActionDocumentationHelper(DocumentationHelper):
Returns the visibility of the documentation helper
"""
TITLE
=
[
'No'
,
'Yes'
]
return
TITLE
[
self
.
getDocumentedObject
().
visible
]
return
TITLE
[
getattr
(
self
.
getDocumentedObject
(),
"visible"
,
0
)
]
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getCategory'
)
def
getCategory
(
self
):
"""
Returns the category of the documentation helper
"""
return
self
.
getDocumentedObject
().
category
return
getattr
(
self
.
getDocumentedObject
(),
"category"
,
''
)
InitializeClass
(
PortalTypeActionDocumentationHelper
)
product/ERP5Type/DocumentationHelper/PortalTypeDocumentationHelper.py
View file @
348e8bd5
...
...
@@ -29,11 +29,10 @@
from
Acquisition
import
Implicit
from
AccessControl
import
ClassSecurityInfo
from
Globals
import
InitializeClass
from
DocumentationHelper
import
DocumentationHelper
from
DocumentationHelper
import
DocumentationHelper
,
TempObjectLibrary
from
DocumentationSection
import
DocumentationSection
from
PortalTypeInstanceDocumentationHelper
import
PortalTypeInstanceDocumentationHelper
from
Products.ERP5Type
import
Permissions
from
zLOG
import
LOG
,
INFO
def
getPortalType
(
uri
=
''
):
"""
...
...
@@ -86,12 +85,12 @@ class PortalTypeDocumentationHelper(DocumentationHelper):
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTempInstance'
)
def
getTempInstance
(
self
,
portal_type
=
''
):
def
getTempInstance
(
self
,
portal_type
):
"""
Returns a temporary instance of the given portal_type
"""
temp_folder
=
self
.
getPortalObject
().
portal_classes
.
newContent
(
id
=
'temp_instance'
,
portal_type
=
'Folder'
,
temp_object
=
1
)
return
temp_folder
.
newContent
(
id
=
portal_type
,
portal_type
=
portal_type
,
temp_object
=
1
)
self
.
getTempInstance
=
TempObjectLibrary
(
self
.
getPortalObject
().
portal_classes
)
return
self
.
getTempInstance
(
portal_type
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getSectionList'
)
def
getSectionList
(
self
):
...
...
@@ -133,13 +132,13 @@ class PortalTypeDocumentationHelper(DocumentationHelper):
id
=
'workflow_method'
,
title
=
'Workflow Method'
,
class_name
=
'WorkflowMethodDocumentationHelper'
,
uri_list
=
self
.
getWorkflowMethodU
RI
List
(
inherited
=
0
),
uri_list
=
self
.
getWorkflowMethodU
ri
List
(
inherited
=
0
),
),
DocumentationSection
(
id
=
'accessor'
,
title
=
'Accessor'
,
class_name
=
'AccessorMethodDocumentationHelper'
,
uri_list
=
self
.
getAccessorMethodU
RI
List
(
inherited
=
0
),
uri_list
=
self
.
getAccessorMethodU
ri
List
(
inherited
=
0
),
),
DocumentationSection
(
id
=
'class_method'
,
...
...
@@ -162,7 +161,7 @@ class PortalTypeDocumentationHelper(DocumentationHelper):
"""
Returns the list of allowed content type of the documentation helper
"""
return
self
.
getDocumentedObject
().
allowed_content_types
return
getattr
(
self
.
getDocumentedObject
(),
"allowed_content_types"
,
[])
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getAllowedContentTypeURIList'
)
def
getAllowedContentTypeURIList
(
self
):
...
...
@@ -177,7 +176,7 @@ class PortalTypeDocumentationHelper(DocumentationHelper):
"""
Returns the list of hidden content type of the documentation helper
"""
return
self
.
getDocumentedObject
().
hidden_content_type_list
return
getattr
(
self
.
getDocumentedObject
(),
"hidden_content_type_list"
,
[])
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getHiddenContentTypeURIList'
)
def
getHiddenContentTypeURIList
(
self
):
...
...
@@ -192,14 +191,15 @@ class PortalTypeDocumentationHelper(DocumentationHelper):
"""
Returns the list of base category of the documentation helper
"""
return
self
.
getDocumentedObject
().
base_category_list
return
getattr
(
self
.
getDocumentedObject
(),
"base_category_list"
,
[])
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getAcquireLocalRoles'
)
def
getAcquireLocalRoles
(
self
):
"""
Returns the list of allowed content type for the documentation helper
"""
if
self
.
getDocumentedObject
().
acquire_local_roles
:
local_roles
=
getattr
(
self
.
getDocumentedObject
(),
"acquire_local_roles"
,
''
)
if
local_roles
:
return
'Yes'
else
:
return
'No'
...
...
@@ -209,7 +209,8 @@ class PortalTypeDocumentationHelper(DocumentationHelper):
"""
Returns the list of property sheets for the documentation helper
"""
temp_object
=
self
.
getTempInstance
(
self
.
getDocumentedObject
().
id
)
id
=
getattr
(
self
.
getDocumentedObject
(),
"id"
,
''
)
temp_object
=
self
.
getTempInstance
(
id
)
property_sheet
=
[]
for
obj
in
temp_object
.
property_sheets
:
property_sheet
.
append
(
obj
.
__module__
.
split
(
'.'
)[
-
1
])
...
...
@@ -230,14 +231,15 @@ class PortalTypeDocumentationHelper(DocumentationHelper):
"""
Returns the list of groups for the documentation helper
"""
return
self
.
getDocumentedObject
().
group_list
return
getattr
(
self
.
getDocumentedObject
(),
"group_list"
,
[])
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getActionIdList'
)
def
getActionIdList
(
self
):
"""
"""
action_list
=
[]
for
action
in
self
.
getDocumentedObject
().
_actions
:
actions
=
getattr
(
self
.
getDocumentedObject
(),
"_actions"
,
[])
for
action
in
actions
:
action_list
.
append
(
action
.
getId
())
return
action_list
...
...
@@ -277,7 +279,8 @@ class PortalTypeDocumentationHelper(DocumentationHelper):
"""
"""
role_list
=
[]
for
role
in
self
.
getDocumentedObject
().
_roles
:
roles
=
getattr
(
self
.
getDocumentedObject
(),
"_roles"
,
''
)
for
role
in
roles
:
role_list
.
append
(
role
.
Title
())
return
role_list
...
...
@@ -312,7 +315,6 @@ class PortalTypeDocumentationHelper(DocumentationHelper):
from
Products.ERP5Type.Base
import
Base
portal_type
=
getPortalType
(
self
.
uri
)
temp_object
=
self
.
getTempInstance
(
portal_type
)
#LOG('yomido1', INFO, 'dir() = %s' % dir(temp_object))
dir_temp
=
dir
(
temp_object
)
return
Base
.
aq_portal_type
[(
portal_type
,
temp_object
.
__class__
)]
...
...
@@ -334,6 +336,20 @@ class PortalTypeDocumentationHelper(DocumentationHelper):
module
=
klass
.
__module__
uri_prefix
=
''
#'%s.%s.' % (module, class_name)
return
map
(
lambda
x
:
'%s%s'
%
(
uri_prefix
,
x
),
method_id_list
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getWorkflowMethodUriList'
)
def
getWorkflowMethodUriList
(
self
,
inherited
=
1
,
local
=
1
):
"""
Returns a list of URIs to workflow methods
"""
method_id_list
=
self
.
getWorkflowMethodIdList
()
portal_type
=
getPortalType
(
self
.
uri
)
klass
=
self
.
getTempInstance
(
portal_type
).
__class__
class_name
=
klass
.
__name__
module
=
klass
.
__module__
uri_prefix
=
'portal_classes/temp_instance/%s'
%
self
.
uri
.
split
(
'/'
)[
-
1
]
return
map
(
lambda
x
:
'%s#%s'
%
(
uri_prefix
,
x
),
method_id_list
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getClassMethodIdList'
)
def
getClassMethodIdList
(
self
,
inherited
=
1
,
local
=
1
):
...
...
@@ -376,5 +392,17 @@ class PortalTypeDocumentationHelper(DocumentationHelper):
uri_prefix
=
'%s.%s.'
%
(
module
,
class_name
)
return
map
(
lambda
x
:
'%s%s'
%
(
uri_prefix
,
x
),
method_id_list
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getAccessorMethodUriList'
)
def
getAccessorMethodUriList
(
self
,
inherited
=
1
,
local
=
1
):
"""
Returns a list of URIs to accessor methods
"""
method_id_list
=
self
.
getAccessorMethodIdList
(
inherited
=
inherited
)
portal_type
=
getPortalType
(
self
.
uri
)
klass
=
self
.
getTempInstance
(
portal_type
).
__class__
.
__bases__
[
0
]
class_name
=
klass
.
__name__
module
=
klass
.
__module__
uri_prefix
=
self
.
uri
return
map
(
lambda
x
:
'%s#%s'
%
(
uri_prefix
,
x
),
method_id_list
)
InitializeClass
(
PortalTypeDocumentationHelper
)
product/ERP5Type/DocumentationHelper/PortalTypePropertySheetDocumentationHelper.py
View file @
348e8bd5
...
...
@@ -54,14 +54,15 @@ class PortalTypePropertySheetDocumentationHelper(DocumentationHelper):
"""
Returns the id of the documentation helper
"""
return
self
.
getDocumentedObject
().
name
.
split
(
"/"
)[
-
1
]
name
=
getattr
(
self
.
getDocumentedObject
(),
"name"
,
''
)
return
name
.
split
(
"/"
)[
-
1
]
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTitle'
)
def
getTitle
(
self
):
"""
Returns the title of the documentation helper
"""
return
self
.
getDocumentedObject
().
name
return
getattr
(
self
.
etDocumentedObject
(),
"name"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getSourceCode'
)
def
getSourceCode
(
self
):
...
...
@@ -75,7 +76,7 @@ class PortalTypePropertySheetDocumentationHelper(DocumentationHelper):
property_sheet_file
.
seek
(
0
)
source_code
=
property_sheet_file
.
read
()
portal_transforms
=
getattr
(
self
,
'portal_transforms'
,
None
)
if
portal_transforms
is
not
None
:
if
portal_transforms
is
None
:
LOG
(
'DCWorkflowScriptDocumentationHelper'
,
INFO
,
'Transformation Tool is not installed. No convertion of python script to html'
)
return
source_code
...
...
product/ERP5Type/DocumentationHelper/PortalTypeRoleDocumentationHelper.py
View file @
348e8bd5
...
...
@@ -31,7 +31,6 @@ from AccessControl import ClassSecurityInfo
from
Globals
import
InitializeClass
from
DocumentationHelper
import
DocumentationHelper
from
Products.ERP5Type
import
Permissions
from
zLOG
import
LOG
,
INFO
class
PortalTypeRoleDocumentationHelper
(
DocumentationHelper
):
"""
...
...
@@ -59,7 +58,7 @@ class PortalTypeRoleDocumentationHelper(DocumentationHelper):
"""
Returns the id of the documentation helper
"""
return
self
.
getDocumentedObject
().
__name__
return
getattr
(
self
.
getDocumentedObject
(),
"__name__"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getSectionList'
)
def
getSectionList
(
self
):
...
...
@@ -73,20 +72,20 @@ class PortalTypeRoleDocumentationHelper(DocumentationHelper):
"""
Returns the title of the documentation helper
"""
return
self
.
getDocumentedObject
().
title
return
getattr
(
self
.
getDocumentedObject
(),
"title"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getCategoryList'
)
def
getCategoryList
(
self
):
"""
Returns the list of categories for the role
"""
return
self
.
getDocumentedObject
().
category
return
getattr
(
self
.
getDocumentedObject
(),
"category"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getBaseCategoryScript'
)
def
getBaseCategoryScript
(
self
):
"""
Returns the base category script of the role
"""
return
self
.
getDocumentedObject
().
base_category_script
return
getattr
(
self
.
getDocumentedObject
(),
"base_category_script"
,
''
)
InitializeClass
(
PortalTypeRoleDocumentationHelper
)
product/ERP5Type/DocumentationHelper/ScriptPythonDocumentationHelper.py
View file @
348e8bd5
...
...
@@ -54,14 +54,14 @@ class ScriptPythonDocumentationHelper(DocumentationHelper):
"""
Returns the id of the documentation helper
"""
return
self
.
getDocumentedObject
().
id
return
getattr
(
self
.
getDocumentedObject
(),
"id"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTitle'
)
def
getTitle
(
self
):
"""
Returns the title of the documentation helper
"""
return
self
.
getDocumentedObject
().
title
return
getattr
(
self
.
getDocumentedObject
(),
"title"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getSourceCode'
)
def
getSourceCode
(
self
):
...
...
@@ -69,7 +69,7 @@ class ScriptPythonDocumentationHelper(DocumentationHelper):
Returns the source code the script python
"""
from
zLOG
import
LOG
,
INFO
source_code
=
self
.
getDocumentedObject
().
_body
source_code
=
getattr
(
self
.
getDocumentedObject
(),
"_body"
,
''
)
portal_transforms
=
getattr
(
self
,
'portal_transforms'
,
None
)
if
portal_transforms
is
None
:
LOG
(
'DCWorkflowScriptDocumentationHelper'
,
INFO
,
...
...
product/ERP5Type/DocumentationHelper/SkinFolderDocumentationHelper.py
View file @
348e8bd5
...
...
@@ -42,6 +42,13 @@ class SkinFolderDocumentationHelper(DocumentationHelper):
def
__init__
(
self
,
uri
):
self
.
uri
=
uri
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getSectionList'
)
def
getSectionList
(
self
):
"""
Returns a list of documentation sections
"""
return
[]
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getType'
)
def
getType
(
self
):
"""
...
...
@@ -54,14 +61,14 @@ class SkinFolderDocumentationHelper(DocumentationHelper):
"""
Returns the id of the documentation helper
"""
return
self
.
getDocumentedObject
().
id
return
getattr
(
self
.
getDocumentedObject
(),
"id"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTitle'
)
def
getTitle
(
self
):
"""
Returns the title of the documentation helper
"""
return
self
.
getDocumentedObject
().
title
return
getattr
(
self
.
getDocumentedObject
(),
"title"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getMetaTypeList'
)
def
getMetaTypeList
(
self
):
...
...
@@ -78,9 +85,11 @@ class SkinFolderDocumentationHelper(DocumentationHelper):
Returns the list of sub-objects ids of the documentation helper
"""
file_list
=
[]
for
file
in
self
.
getDocumentedObject
().
objectValues
():
if
not
meta_type
or
file
.
meta_type
==
meta_type
:
file_list
.
append
(
file
.
id
)
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'
)
...
...
@@ -89,9 +98,11 @@ class SkinFolderDocumentationHelper(DocumentationHelper):
Returns the list of sub-objects items of the documentation helper
"""
file_list
=
[]
for
file
in
self
.
getDocumentedObject
().
objectValues
():
if
not
meta_type
or
file
.
meta_type
==
meta_type
:
file_list
.
append
((
file
.
id
,
file
.
title
,
file
.
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
,
file
.
title
,
file
.
meta_type
))
return
file_list
InitializeClass
(
SkinFolderDocumentationHelper
)
product/ERP5Type/DocumentationHelper/SkinFolderItemDocumentationHelper.py
View file @
348e8bd5
...
...
@@ -47,28 +47,28 @@ class SkinFolderItemDocumentationHelper(DocumentationHelper):
"""
Returns the type of the documentation helper
"""
return
self
.
getDocumentedObject
().
meta_type
return
getattr
(
self
.
getDocumentedObject
(),
"meta_type"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getId'
)
def
getId
(
self
):
"""
Returns the id of the documentation helper
"""
return
self
.
getDocumentedObject
().
id
return
getattr
(
self
.
getDocumentedObject
(),
"id"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTitle'
)
def
getTitle
(
self
):
"""
Returns the title of the documentation helper
"""
return
self
.
getDocumentedObject
().
title
return
getattr
(
self
.
getDocumentedObject
(),
"title"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getContentType'
)
def
getContentType
(
self
):
"""
Returns the title of the documentation helper
"""
return
self
.
getDocumentedObject
().
content_type
return
getattr
(
self
.
getDocumentedObject
(),
"content_type"
,
''
)
...
...
product/ERP5Type/DocumentationHelper/WorkflowMethodDocumentationHelper.py
View file @
348e8bd5
...
...
@@ -45,7 +45,7 @@ class WorkflowMethodDocumentationHelper(DocumentationHelper):
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getDescription'
)
def
getDescription
(
self
):
return
self
.
getDocumentedObject
().
__doc__
return
getattr
(
self
.
getDocumentedObject
(),
"__doc__"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getType'
)
def
getType
(
self
):
...
...
@@ -53,14 +53,13 @@ class WorkflowMethodDocumentationHelper(DocumentationHelper):
Returns the type of the documentation helper
"""
return
"Workflow Method"
#return self.getDocumentedObject().__module__
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTitle'
)
def
getTitle
(
self
):
"""
Returns the title of the documentation helper
"""
return
self
.
getDocumentedObject
().
__name__
return
getattr
(
self
.
getDocumentedObject
(),
"__name__"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getSectionList'
)
def
getSectionList
(
self
):
...
...
product/ERP5Type/DocumentationHelper/ZSQLMethodDocumentationHelper.py
View file @
348e8bd5
...
...
@@ -54,14 +54,14 @@ class ZSQLMethodDocumentationHelper(DocumentationHelper):
"""
Returns the id of the documentation helper
"""
return
self
.
getDocumentedObject
().
id
return
getattr
(
self
.
getDocumentedObject
(),
"id"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTitle'
)
def
getTitle
(
self
):
"""
Returns the title of the documentation helper
"""
return
self
.
getDocumentedObject
().
title
return
getattr
(
self
.
getDocumentedObject
(),
"title"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getSource'
)
def
getSource
(
self
):
...
...
@@ -69,7 +69,7 @@ class ZSQLMethodDocumentationHelper(DocumentationHelper):
Returns the source code of the documentation helper
"""
from
zLOG
import
LOG
,
INFO
source_code
=
self
.
getDocumentedObject
().
src
source_code
=
getattr
(
self
.
getDocumentedObject
(),
"src"
,
''
)
portal_transforms
=
getattr
(
self
,
'portal_transforms'
,
None
)
if
portal_transforms
is
None
:
LOG
(
'DCWorkflowScriptDocumentationHelper'
,
INFO
,
...
...
@@ -85,34 +85,34 @@ class ZSQLMethodDocumentationHelper(DocumentationHelper):
"""
Returns the title of the documentation helper
"""
return
self
.
getDocumentedObject
().
connection_id
return
getattr
(
self
.
getDocumentedObject
(),
"connection_id"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getArgumentList'
)
def
getArgumentList
(
self
):
"""
Returns the arguments of the documentation helper
"""
return
self
.
getDocumentedObject
().
arguments_src
return
getattr
(
self
.
getDocumentedObject
(),
"arguments_src"
,
[])
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getClassName'
)
def
getClassName
(
self
):
"""
Returns the class name of the documentation helper
"""
return
self
.
getDocumentedObject
().
class_name_
return
getattr
(
self
.
getDocumentedObject
(),
"class_name_"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getClassFile'
)
def
getClassFile
(
self
):
"""
Returns the class file of the documentation helper
"""
return
self
.
getDocumentedObject
().
class_file_
return
getattr
(
self
.
getDocumentedObject
(),
"class_file_"
,
''
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getMaxRows'
)
def
getMaxRows
(
self
):
"""
Returns the of the documentation helper
"""
return
self
.
getDocumentedObject
().
max_rows_
return
getattr
(
self
.
getDocumentedObject
(),
"max_rows_"
,
''
)
InitializeClass
(
ZSQLMethodDocumentationHelper
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment