Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5_fork
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
erp5_fork
Commits
0c9063ec
Commit
0c9063ec
authored
Dec 17, 2014
by
wenjie.zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix new line markers.
parent
70ad0fcb
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
46 deletions
+30
-46
product/ERP5Type/Base.py
product/ERP5Type/Base.py
+2
-23
product/ERP5Type/ERP5Type.py
product/ERP5Type/ERP5Type.py
+1
-5
product/ERP5Type/dynamic/lazy_class.py
product/ERP5Type/dynamic/lazy_class.py
+23
-9
product/ERP5Workflow/Document/Workflow.py
product/ERP5Workflow/Document/Workflow.py
+4
-9
No files found.
product/ERP5Type/Base.py
View file @
0c9063ec
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#
#
# Copyright (c) 2002-2003 Nexedi SARL and Contributors. All Rights Reserved.
# Copyright (c) 2002-2003 Nexedi SARL and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
# Jean-Paul Smets-Solanes <jp@nexedi.com>
# 2014 Wenjie Zheng <wenjie.zheng@tiolive.com>
#
#
# WARNING: This program as such is intended to be used by professional
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# programmers who take the whole responsability of assessing all potential
...
@@ -109,7 +110,7 @@ _MARKER = []
...
@@ -109,7 +110,7 @@ _MARKER = []
global
registered_workflow_method_set
global
registered_workflow_method_set
wildcard_interaction_method_id_match
=
re
.
compile
(
r'[[.?*+{(\\]'
).
search
wildcard_interaction_method_id_match
=
re
.
compile
(
r'[[.?*+{(\\]'
).
search
workflow_method_registry
=
[]
# XXX A set() would be better but would require a hash in WorkflowMethod class
workflow_method_registry
=
[]
# XXX A set() would be better but would require a hash in WorkflowMethod class
erp5workflow_method_registry
=
[]
erp5workflow_method_registry
=
[]
def
resetRegisteredWorkflowMethod
(
portal_type
=
None
):
def
resetRegisteredWorkflowMethod
(
portal_type
=
None
):
"""
"""
...
@@ -659,38 +660,16 @@ def getClassPropertyList(klass):
...
@@ -659,38 +660,16 @@ def getClassPropertyList(klass):
if
p
not
in
ps_list
])
if
p
not
in
ps_list
])
return
ps_list
return
ps_list
# =================== ERP5Workflow Project, Wenjie, Dec 2014 ======================
### this function will be used in /product/ERP5Type/dynamic/lazy_class.py
### in generatePortalTypeAccessors()
def
intializePortalTypeERP5WorkflowMethod
(
ptype_klass
,
portal_ERP5Workflow
):
def
intializePortalTypeERP5WorkflowMethod
(
ptype_klass
,
portal_ERP5Workflow
):
### portal_ERP5Workflow is the entire ERP5Workflow module, need to access the
### workflow_list from instance's portal type. So only the related erp5 workflow will be used.
wf5_module
=
aq_inner
(
portal_ERP5Workflow
)
wf5_module
=
aq_inner
(
portal_ERP5Workflow
)
portal_type
=
portal_ERP5Workflow
.
getPortalObject
().
getDefaultModule
(
portal_type
=
"portal_types"
)
portal_type
=
portal_ERP5Workflow
.
getPortalObject
().
getDefaultModule
(
portal_type
=
"portal_types"
)
pt
=
portal_type
.
_getOb
(
ptype_klass
.
__name__
)
pt
=
portal_type
.
_getOb
(
ptype_klass
.
__name__
)
#raise NotImplementedError (portal_type)
#raise NotImplementedError (wf5_module)#<Workflow Module at workflow_module>
### creat workflow method:
for
ERP5Workflow
in
pt
.
workflow_list
:
for
ERP5Workflow
in
pt
.
workflow_list
:
for
tr
in
wf5_module
.
_getOb
(
ERP5Workflow
).
objectValues
(
portal_type
=
"Transition"
):
for
tr
in
wf5_module
.
_getOb
(
ERP5Workflow
).
objectValues
(
portal_type
=
"Transition"
):
tr_id
=
tr
.
id
tr_id
=
tr
.
id
method_id
=
convertToMixedCase
(
tr_id
)
method_id
=
convertToMixedCase
(
tr_id
)
wf_id
=
ERP5Workflow
wf_id
=
ERP5Workflow
ptype_klass
.
registerERP5WorkflowMethod
(
method_id
,
wf_id
,
tr_id
,
0
)
ptype_klass
.
registerERP5WorkflowMethod
(
method_id
,
wf_id
,
tr_id
,
0
)
#ptype_klass.security.declareProtected(Permissions.AccessContentsInformation,
# method_id)
#ptype_klass.registerWorkflowMethod(method_id, wf_id, tr_id)
#method = getattr(ptype_klass, method_id)
#method = getattr(ptype_klass, method_id, _MARKER) # _MARKER = []
#if method is _MARKER:
#ptype_klass.security.declareProtected(Permissions.AccessContentsInformation,
# method_id)
# ptype_klass.registerWorkflowMethod(method_id, wf_id, tr_id, 0)
# continue
#method.registerTransitionAlways(portal_type, wf_id, tr_id)
# =================== WF5 ======================================================
def
initializePortalTypeDynamicWorkflowMethods
(
ptype_klass
,
portal_workflow
):
def
initializePortalTypeDynamicWorkflowMethods
(
ptype_klass
,
portal_workflow
):
"""We should now make sure workflow methods are defined
"""We should now make sure workflow methods are defined
...
...
product/ERP5Type/ERP5Type.py
View file @
0c9063ec
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
# Copyright (c) 2002-2004 Nexedi SARL and Contributors. All Rights Reserved.
# Copyright (c) 2002-2004 Nexedi SARL and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
#
2014 Wenjie.Zheng <wenjie.zheng@tiolive.com>
# WARNING: This program as such is intended to be used by professional
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# consequences resulting from its eventual inadequacies and bugs
...
@@ -418,14 +418,10 @@ class ERP5TypeInformation(XMLObject,
...
@@ -418,14 +418,10 @@ class ERP5TypeInformation(XMLObject,
for
workflow
in
workflow_tool
.
getWorkflowsFor
(
ob
):
for
workflow
in
workflow_tool
.
getWorkflowsFor
(
ob
):
workflow
.
notifyCreated
(
ob
)
workflow
.
notifyCreated
(
ob
)
# =========== Project ERP5Workflow , WENJIE , 2014 ================================
### workflow_list need to be defined somewhere.
### exp: ERP5Workflow in Person module won't work at this situation.
for
ERP5Workflow
in
self
.
getTypeWorkflowList
():
for
ERP5Workflow
in
self
.
getTypeWorkflowList
():
workflow_module
=
portal
.
getDefaultModule
(
portal_type
=
"Workflow"
)
workflow_module
=
portal
.
getDefaultModule
(
portal_type
=
"Workflow"
)
ERP5Workflow
=
workflow_module
.
_getOb
(
ERP5Workflow
)
ERP5Workflow
=
workflow_module
.
_getOb
(
ERP5Workflow
)
ERP5Workflow
.
initializeDocument
(
ob
)
ERP5Workflow
.
initializeDocument
(
ob
)
# =========== WF5 ==============================================================
if
not
temp_object
:
if
not
temp_object
:
init_script
=
self
.
getTypeInitScriptId
()
init_script
=
self
.
getTypeInitScriptId
()
...
...
product/ERP5Type/dynamic/lazy_class.py
View file @
0c9063ec
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
# Copyright (c) 2002-2004 Nexedi SARL and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
# 2014 Wenjie.Zheng <wenjie.zheng@tiolive.com>
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
import
sys
import
sys
from
Products.ERP5Type
import
Permissions
from
Products.ERP5Type
import
Permissions
...
@@ -266,25 +287,18 @@ class PortalTypeMetaClass(GhostBaseMetaClass, PropertyHolder):
...
@@ -266,25 +287,18 @@ class PortalTypeMetaClass(GhostBaseMetaClass, PropertyHolder):
else
:
else
:
initializePortalTypeDynamicWorkflowMethods
(
cls
,
portal_workflow
)
initializePortalTypeDynamicWorkflowMethods
(
cls
,
portal_workflow
)
# ================== ERP5Workflow Project, Wenjie, Dec 2014 =======================
portal_type
=
site
.
getDefaultModule
(
portal_type
=
"portal_types"
)
portal_type
=
site
.
getDefaultModule
(
portal_type
=
"portal_types"
)
### try to get workflow_list from related types then initialize the class of types
pt
=
portal_type
.
_getOb
(
cls
.
__name__
,
None
)
pt
=
getattr
(
portal_type
,
cls
.
__name__
,
None
)
if
pt
is
not
None
:
if
pt
is
not
None
:
#pt = portal_type._getOb(cls.__name__)
#raise NotImplemented (pt)
wf
=
getattr
(
pt
,
'workflow_list'
,
None
)
wf
=
getattr
(
pt
,
'workflow_list'
,
None
)
if
wf
is
not
None
:
if
wf
is
not
None
:
### Get ERP5Workflow Module
portal_ERP5Workflow
=
site
.
getDefaultModule
(
portal_type
=
"Workflow"
)
portal_ERP5Workflow
=
site
.
getDefaultModule
(
portal_type
=
"Workflow"
)
if
portal_ERP5Workflow
is
None
:
if
portal_ERP5Workflow
is
None
:
LOG
(
"ERP5Type.Dynamic"
,
WARNING
,
LOG
(
"ERP5Type.Dynamic"
,
WARNING
,
"no ERP5Workflow methods for %s"
"no ERP5Workflow methods for %s"
%
cls
.
__name__
)
%
cls
.
__name__
)
else
:
else
:
### Generate Workflow Method
intializePortalTypeERP5WorkflowMethod
(
cls
,
portal_ERP5Workflow
)
intializePortalTypeERP5WorkflowMethod
(
cls
,
portal_ERP5Workflow
)
# ================== WF5 =======================================================
# portal type group methods, isNodeType, isResourceType...
# portal type group methods, isNodeType, isResourceType...
from
Products.ERP5Type.ERP5Type
import
ERP5TypeInformation
from
Products.ERP5Type.ERP5Type
import
ERP5TypeInformation
...
...
product/ERP5Workflow/Document/Workflow.py
View file @
0c9063ec
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
#
#
# Copyright (c) 2006 Nexedi SARL and Contributors. All Rights Reserved.
# Copyright (c) 2006 Nexedi SARL and Contributors. All Rights Reserved.
# Romain Courteaud <romain@nexedi.com>
# Romain Courteaud <romain@nexedi.com>
#
#
2014 Wenjie Zheng <wenjie.zheng@tiolive.com>
# WARNING: This program as such is intended to be used by professional
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# consequences resulting from its eventual inadequacies and bugs
...
@@ -40,7 +40,6 @@ from Products.DCWorkflowGraph.config import DOT_EXE
...
@@ -40,7 +40,6 @@ from Products.DCWorkflowGraph.config import DOT_EXE
from
Products.DCWorkflowGraph.DCWorkflowGraph
import
bin_search
,
getGraph
from
Products.DCWorkflowGraph.DCWorkflowGraph
import
bin_search
,
getGraph
from
Products.ERP5Type.Utils
import
UpperCase
from
Products.ERP5Type.Utils
import
UpperCase
from
Acquisition
import
aq_base
from
Acquisition
import
aq_base
#import String
from
DateTime
import
DateTime
from
DateTime
import
DateTime
class
Workflow
(
XMLObject
):
class
Workflow
(
XMLObject
):
...
@@ -53,9 +52,6 @@ class Workflow(XMLObject):
...
@@ -53,9 +52,6 @@ class Workflow(XMLObject):
add_permission
=
Permissions
.
AddPortalContent
add_permission
=
Permissions
.
AddPortalContent
isPortalContent
=
1
isPortalContent
=
1
isRADContent
=
1
isRADContent
=
1
### register the variable given by "base category value"
#state_var = 'state'
### In DCworkflow; state/transition can be registered inside workflow
# Declarative security
# Declarative security
security
=
ClassSecurityInfo
()
security
=
ClassSecurityInfo
()
...
@@ -143,7 +139,7 @@ class Workflow(XMLObject):
...
@@ -143,7 +139,7 @@ class Workflow(XMLObject):
transition
=
transition
,
transition
=
transition
,
transition_url
=
transition_url
,
transition_url
=
transition_url
,
state
=
state
)
state
=
state
)
# ========== ERP5Workflow Project, Wenjie, Dec 2014 ===============================
def
isERP5WorkflowMethodSupported
(
self
,
document
,
transition
):
def
isERP5WorkflowMethodSupported
(
self
,
document
,
transition
):
sdef
=
self
.
_getERP5WorkflowStateOf
(
document
)
sdef
=
self
.
_getERP5WorkflowStateOf
(
document
)
if
sdef
is
None
:
if
sdef
is
None
:
...
@@ -152,17 +148,16 @@ class Workflow(XMLObject):
...
@@ -152,17 +148,16 @@ class Workflow(XMLObject):
return
1
return
1
return
0
return
0
### get workflow state from base category value:
def
_getERP5WorkflowStateOf
(
self
,
ob
):
def
_getERP5WorkflowStateOf
(
self
,
ob
):
bc_id
=
self
.
getStateBaseCategory
()
bc_id
=
self
.
getStateBaseCategory
()
state_path
=
ob
.
getCategoryList
()
state_path
=
ob
.
getCategoryList
()
state_path
=
state_path
[
0
].
lstrip
(
"%s/"
%
bc_id
)
state_path
=
state_path
[
0
].
lstrip
(
"%s/"
%
bc_id
)
###
if
state_path
is
not
None
:
if
state_path
is
not
None
:
sdef
=
self
.
restrictedTraverse
(
state_path
)
sdef
=
self
.
restrictedTraverse
(
state_path
)
else
:
sdef
=
None
else
:
sdef
=
None
return
sdef
return
sdef
# =========== WF5 ==============================================================
###########
###########
## Graph ##
## Graph ##
############
############
...
...
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