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
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
Tomáš Peterka
erp5
Commits
d8c7e3f9
Commit
d8c7e3f9
authored
Dec 16, 2014
by
wenjie.zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lazy_class use _getOb instead getattr, remove unnecessary commentaries.
parent
70ad0fcb
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
3860 additions
and
3891 deletions
+3860
-3891
product/ERP5Type/Base.py
product/ERP5Type/Base.py
+3639
-3658
product/ERP5Type/ERP5Type.py
product/ERP5Type/ERP5Type.py
+0
-4
product/ERP5Type/dynamic/lazy_class.py
product/ERP5Type/dynamic/lazy_class.py
+3
-10
product/ERP5Workflow/Document/Workflow.py
product/ERP5Workflow/Document/Workflow.py
+218
-219
No files found.
product/ERP5Type/Base.py
View file @
d8c7e3f9
...
...
@@ -492,7 +492,7 @@ class PropertyHolder(object):
self
.
__name__
=
name
self
.
security
=
ClassSecurityInfo
()
# We create a new security info object
self
.
workflow_method_registry
=
{}
self
.
erp5workflow_method_registry
=
{}
self
.
erp5workflow_method_registry
=
{}
self
.
_categories
=
[]
self
.
_properties
=
[]
...
...
@@ -659,19 +659,12 @@ def getClassPropertyList(klass):
if
p
not
in
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
):
### 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.
### this function will be used in /product/ERP5Type/dynamic/lazy_class.py
### in generatePortalTypeAccessors()
wf5_module
=
aq_inner
(
portal_ERP5Workflow
)
portal_type
=
portal_ERP5Workflow
.
getPortalObject
().
getDefaultModule
(
portal_type
=
"portal_types"
)
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
tr
in
wf5_module
.
_getOb
(
ERP5Workflow
).
objectValues
(
portal_type
=
"Transition"
):
...
...
@@ -679,18 +672,6 @@ def intializePortalTypeERP5WorkflowMethod(ptype_klass, portal_ERP5Workflow):
method_id
=
convertToMixedCase
(
tr_id
)
wf_id
=
ERP5Workflow
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
):
"""We should now make sure workflow methods are defined
...
...
product/ERP5Type/ERP5Type.py
View file @
d8c7e3f9
...
...
@@ -418,14 +418,10 @@ class ERP5TypeInformation(XMLObject,
for
workflow
in
workflow_tool
.
getWorkflowsFor
(
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
():
workflow_module
=
portal
.
getDefaultModule
(
portal_type
=
"Workflow"
)
ERP5Workflow
=
workflow_module
.
_getOb
(
ERP5Workflow
)
ERP5Workflow
.
initializeDocument
(
ob
)
# =========== WF5 ==============================================================
if
not
temp_object
:
init_script
=
self
.
getTypeInitScriptId
()
...
...
product/ERP5Type/dynamic/lazy_class.py
View file @
d8c7e3f9
...
...
@@ -266,25 +266,18 @@ class PortalTypeMetaClass(GhostBaseMetaClass, PropertyHolder):
else
:
initializePortalTypeDynamicWorkflowMethods
(
cls
,
portal_workflow
)
# ================== ERP5Workflow Project, Wenjie, Dec 2014 =======================
portal_type
=
site
.
getDefaultModule
(
portal_type
=
"portal_types"
)
### try to get workflow_list from related types then initialize the class of types
pt
=
getattr
(
portal_type
,
cls
.
__name__
,
None
)
pt
=
portal_type
.
_getOb
(
cls
.
__name__
,
None
)
if
pt
is
not
None
:
#pt = portal_type._getOb(cls.__name__)
#raise NotImplemented (pt)
wf
=
getattr
(
pt
,
'workflow_list'
,
None
)
if
wf
is
not
None
:
### Get ERP5Workflow Module
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
,
"no ERP5Workflow methods for %s"
%
cls
.
__name__
)
else
:
### Generate Workflow Method
intializePortalTypeERP5WorkflowMethod
(
cls
,
portal_ERP5Workflow
)
# ================== WF5 =======================================================
# portal type group methods, isNodeType, isResourceType...
from
Products.ERP5Type.ERP5Type
import
ERP5TypeInformation
...
...
product/ERP5Workflow/Document/Workflow.py
View file @
d8c7e3f9
##############################################################################
#
# Copyright (c) 2006
Nexedi SARL and Contributors. All Rights Reserved.
# Copyright (c) 2006
,2014 Nexedi SARL and Contributors. All Rights Reserved.
# Romain Courteaud <romain@nexedi.com>
#
#
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
...
...
@@ -40,7 +40,6 @@ from Products.DCWorkflowGraph.config import DOT_EXE
from
Products.DCWorkflowGraph.DCWorkflowGraph
import
bin_search
,
getGraph
from
Products.ERP5Type.Utils
import
UpperCase
from
Acquisition
import
aq_base
#import String
from
DateTime
import
DateTime
class
Workflow
(
XMLObject
):
...
...
@@ -143,7 +142,7 @@ class Workflow(XMLObject):
transition
=
transition
,
transition_url
=
transition_url
,
state
=
state
)
# ========== ERP5Workflow Project, Wenjie, Dec 2014 ===============================
def
isERP5WorkflowMethodSupported
(
self
,
document
,
transition
):
sdef
=
self
.
_getERP5WorkflowStateOf
(
document
)
if
sdef
is
None
:
...
...
@@ -162,7 +161,7 @@ class Workflow(XMLObject):
sdef
=
self
.
restrictedTraverse
(
state_path
)
else
:
sdef
=
None
return
sdef
# =========== WF5 ==============================================================
###########
## 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