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
Ekaterina
erp5
Commits
476d6715
Commit
476d6715
authored
Jan 02, 2015
by
wenjie.zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
==== DEPLOY erp5workflow_list ====
parent
5a980f25
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
36 deletions
+44
-36
product/ERP5/tests/testBase.py
product/ERP5/tests/testBase.py
+1
-1
product/ERP5Type/Base.py
product/ERP5Type/Base.py
+19
-16
product/ERP5Type/ERP5Type.py
product/ERP5Type/ERP5Type.py
+11
-8
product/ERP5Type/dynamic/lazy_class.py
product/ERP5Type/dynamic/lazy_class.py
+13
-11
No files found.
product/ERP5/tests/testBase.py
View file @
476d6715
...
...
@@ -1288,7 +1288,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
"""
module
=
self
.
portal
.
person_module
person
=
module
.
newContent
(
portal_type
=
'Person'
)
self
.
assertEqual
(
person
.
getValidationState
(),
'draft'
)
self
.
assertEqual
(
person
.
getValidationState
Id
(),
'draft'
)
self
.
assertFalse
(
self
.
portal
.
portal_workflow
.
isTransitionPossible
(
person
,
'invalidate'
))
# test low-level implementation
...
...
product/ERP5Type/Base.py
View file @
476d6715
...
...
@@ -120,9 +120,6 @@ def resetRegisteredWorkflowMethod(portal_type=None):
method
.
reset
(
portal_type
=
portal_type
)
def
resetRegisteredERP5WorkflowMethod
(
portal_type
=
None
):
"""
TODO: unwrap workflow methos which were standard methods initially
"""
for
method
in
erp5workflow_method_registry
:
method
.
reset
(
portal_type
=
portal_type
)
...
...
@@ -146,11 +143,7 @@ class ERP5WorkflowMethod(Method):
self
.
_transition_id
=
method
.
__name__
else
:
self
.
_transition_id
=
id
# Only publishable methods can be published as interactions
# A pure private method (ex. _doNothing) can not be published
# This is intentional to prevent methods such as submit, share to
# be called from a URL. If someone can show that this way
# is wrong (ex. for remote operation of a site), let us know.
if
not
method
.
__name__
.
startswith
(
'_'
):
self
.
__name__
=
method
.
__name__
for
func_id
in
[
'func_code'
,
'func_defaults'
,
'func_dict'
,
'func_doc'
,
'func_globals'
,
'func_name'
]:
...
...
@@ -206,20 +199,20 @@ class ERP5WorkflowMethod(Method):
if
not
candidate_transition_item_list
:
return
apply
(
self
.
__dict__
[
'_m'
],
(
instance
,)
+
args
,
kw
)
if
instance
.
getTypeInfo
().
getTypeWorkflowList
():
if
instance
.
getTypeInfo
().
getType
ERP5
WorkflowList
():
wf5_module
=
instance
.
getPortalObject
().
getDefaultModule
(
portal_type
=
"Workflow"
)
### Build the list of method which is call and will be invoked.
valid_transition_item_list
=
[]
for
wf_id
,
transition_list
in
candidate_transition_item_list
:
valid_list
=
[]
for
transition_id
in
transition_list
:
LOG
(
'Executing %s in %s'
%
(
transition_id
,
wf_id
),
WARNING
,
"lol"
)
if
wf5_module
.
_getOb
(
wf_id
).
isERP5WorkflowMethodSupported
(
instance
,
wf5_module
.
_getOb
(
wf_id
).
_getOb
(
transition_id
)):
#if wf5_module._getOb(wf_id)._getOb(transition_id) in instance.getCategoryStateValue().getDestinationValueList():
valid_list
.
append
(
transition_id
)
once_transition_key
=
once_transition_dict
.
get
((
wf_id
,
transition_id
))
transactional_variable
[
once_transition_key
]
=
1
#else: ### don't do anything if no supported
#raise UnsupportedWorkflowMethod(instance, wf_id, transition_id
)
else
:
raise
NotImplementedError
(
"The Transition is not supported by current state."
)
if
valid_list
:
valid_transition_item_list
.
append
((
wf_id
,
valid_list
))
...
...
@@ -251,6 +244,17 @@ class ERP5WorkflowMethod(Method):
Registers the method so that _aq_reset may later reset it
"""
erp5workflow_method_registry
.
append
(
self
)
def
reset
(
self
,
portal_type
=
None
):
"""
Reset the list of registered interactions or transitions
"""
if
portal_type
:
self
.
_invoke_once
[
portal_type
]
=
{}
self
.
_invoke_always
[
portal_type
]
=
{}
else
:
self
.
_invoke_once
=
{}
self
.
_invoke_always
=
{}
class
WorkflowMethod
(
Method
):
...
...
@@ -664,7 +668,7 @@ def intializePortalTypeERP5WorkflowMethod(ptype_klass, portal_ERP5Workflow):
wf5_module
=
aq_inner
(
portal_ERP5Workflow
)
portal_type
=
portal_ERP5Workflow
.
getPortalObject
().
getDefaultModule
(
portal_type
=
"portal_types"
)
pt
=
portal_type
.
_getOb
(
ptype_klass
.
__name__
)
for
ERP5Workflow
in
pt
.
workflow_list
:
for
ERP5Workflow
in
pt
.
erp5
workflow_list
:
for
tr
in
wf5_module
.
_getOb
(
ERP5Workflow
).
objectValues
(
portal_type
=
"Transition"
):
tr_id
=
tr
.
id
method_id
=
convertToMixedCase
(
tr_id
)
...
...
@@ -1512,8 +1516,8 @@ class Base( CopyContainer,
ERP5PropertyManager
.
_setPropValue
(
self
,
key
,
value
)
#except ConflictError:
# raise
# This should not be there, because this ignore all checks made by
# the PropertyManager. If there
is
problems, please complain to
# This should not be there, because this ignore
s
all checks made by
# the PropertyManager. If there
are
problems, please complain to
# seb@nexedi.com
#except:
# # This should be removed if we want strict property checking
...
...
@@ -1612,7 +1616,6 @@ class Base( CopyContainer,
for
method
in
permissions
[
1
]:
if
method
.
startswith
(
'set'
):
restricted_method_set
.
add
(
method
)
getProperty
=
self
.
getProperty
hasProperty
=
self
.
hasProperty
_setProperty
=
self
.
_setProperty
...
...
product/ERP5Type/ERP5Type.py
View file @
476d6715
...
...
@@ -241,7 +241,7 @@ class ERP5TypeInformation(XMLObject,
acquire_local_roles
=
False
property_sheet_list
=
()
base_category_list
=
()
workflow_list
=
()
erp5
workflow_list
=
()
init_script
=
''
product
=
'ERP5Type'
hidden_content_type_list
=
()
...
...
@@ -418,10 +418,12 @@ class ERP5TypeInformation(XMLObject,
for
workflow
in
workflow_tool
.
getWorkflowsFor
(
ob
):
workflow
.
notifyCreated
(
ob
)
for
ERP5Workflow
in
self
.
getTypeWorkflowList
():
### zwj: checked 31 Dec 2104
for
ERP5Workflow
in
self
.
getTypeERP5WorkflowList
():
workflow_module
=
portal
.
getDefaultModule
(
portal_type
=
"Workflow"
)
ERP5Workflow
=
workflow_module
.
_getOb
(
ERP5Workflow
)
ERP5Workflow
.
initializeDocument
(
ob
)
if
workflow_module
is
not
None
:
ERP5Workflow
=
workflow_module
.
_getOb
(
ERP5Workflow
)
ERP5Workflow
.
initializeDocument
(
ob
)
if
not
temp_object
:
init_script
=
self
.
getTypeInitScriptId
()
...
...
@@ -453,11 +455,12 @@ class ERP5TypeInformation(XMLObject,
"""Getter for 'type_base_category' property"""
return
list
(
self
.
base_category_list
)
### erp5workflow get erp5workflow_list
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getTypeWorkflowList'
)
def
getTypeWorkflowList
(
self
):
'getType
ERP5
WorkflowList'
)
def
getType
ERP5
WorkflowList
(
self
):
"""Getter for 'type_workflow' property"""
return
list
(
self
.
workflow_list
)
return
list
(
self
.
erp5
workflow_list
)
def
getTypePropertySheetValueList
(
self
):
type_property_sheet_list
=
self
.
getTypePropertySheetList
()
...
...
@@ -584,7 +587,7 @@ class ERP5TypeInformation(XMLObject,
self
.
getTypeInitScriptId
()]
search_source_list
+=
self
.
getTypePropertySheetList
()
search_source_list
+=
self
.
getTypeBaseCategoryList
()
search_source_list
+=
self
.
getTypeWorkflowList
()
search_source_list
+=
self
.
getType
ERP5
WorkflowList
()
return
' '
.
join
(
filter
(
None
,
search_source_list
))
security
.
declarePrivate
(
'getDefaultViewFor'
)
...
...
product/ERP5Type/dynamic/lazy_class.py
View file @
476d6715
...
...
@@ -286,19 +286,21 @@ class PortalTypeMetaClass(GhostBaseMetaClass, PropertyHolder):
else
:
initializePortalTypeDynamicWorkflowMethods
(
cls
,
portal_workflow
)
portal_type
=
site
.
getDefaultModule
(
portal_type
=
"portal_types"
)
pt
=
portal_type
.
_getOb
(
cls
.
__name__
,
None
)
if
pt
is
not
None
:
workflow_list
=
getattr
(
pt
,
'workflow_list'
,
None
)
if
workflow_list
is
not
None
:
portal_ERP5Workflow
=
site
.
getDefaultModule
(
portal_type
=
"Workflow"
)
if
portal_ERP5Workflow
is
None
:
LOG
(
"ERP5Type.Dynamic"
,
WARNING
,
portal_types
=
site
.
getDefaultModule
(
portal_type
=
"portal_types"
)
object_ptype
=
portal_types
.
_getOb
(
cls
.
__name__
,
None
)
if
object_ptype
is
not
None
:
workflow_list
=
getattr
(
object_ptype
,
'erp5workflow_list'
,
None
)
try
:
if
workflow_list
is
not
None
:
portal_ERP5Workflow
=
site
.
getDefaultModule
(
portal_type
=
"Workflow"
)
if
portal_ERP5Workflow
is
None
:
LOG
(
"ERP5Type.Dynamic"
,
WARNING
,
"no ERP5Workflow methods for %s"
%
cls
.
__name__
)
else
:
intializePortalTypeERP5WorkflowMethod
(
cls
,
portal_ERP5Workflow
)
else
:
intializePortalTypeERP5WorkflowMethod
(
cls
,
portal_ERP5Workflow
)
except
:
pass
# portal type group methods, isNodeType, isResourceType...
from
Products.ERP5Type.ERP5Type
import
ERP5TypeInformation
# XXX possible optimization:
...
...
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