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
Carlos Ramos Carreño
erp5
Commits
79b666bd
Commit
79b666bd
authored
Mar 20, 2015
by
wenjie.zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
patches/Expression.py: add ERP5Workflow compatibility.
parent
d96144a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
1 deletion
+58
-1
product/ERP5Type/patches/Expression.py
product/ERP5Type/patches/Expression.py
+58
-1
No files found.
product/ERP5Type/patches/Expression.py
View file @
79b666bd
...
...
@@ -15,8 +15,65 @@
# Expression patch
from
Products.CMFCore.Expression
import
Expression
from
Acquisition
import
aq_inner
from
Acquisition
import
aq_parent
from
Products.PageTemplates.Expressions
import
getEngine
from
Products.PageTemplates.Expressions
import
SecureModuleImporter
from
AccessControl.SecurityManagement
import
getSecurityManager
from
Products.DCWorkflow.Expression
import
StateChangeInfo
def
Expression_hash
(
self
):
return
hash
(
self
.
text
)
Expression
.
__hash__
=
Expression_hash
def
Expression_createExprContext
(
sci
):
'''
An expression context provides names for TALES expressions.
'''
ob
=
sci
.
object
wf
=
sci
.
workflow
if
wf
.
getTypeInfo
().
getId
()
==
'Workflow'
:
scripts
=
wf
.
objectValues
(
portal_type
=
'Workflow Script'
)
else
:
scripts
=
wf
.
scripts
container
=
aq_parent
(
aq_inner
(
ob
))
data
=
{
'here'
:
ob
,
'object'
:
ob
,
'container'
:
container
,
'folder'
:
container
,
'nothing'
:
None
,
'root'
:
ob
.
getPhysicalRoot
(),
'request'
:
getattr
(
ob
,
'REQUEST'
,
None
),
'modules'
:
SecureModuleImporter
,
'user'
:
getSecurityManager
().
getUser
(),
'state_change'
:
sci
,
'transition'
:
sci
.
transition
,
'status'
:
sci
.
status
,
'kwargs'
:
sci
.
kwargs
,
'workflow'
:
wf
,
'scripts'
:
scripts
,
}
return
getEngine
().
getContext
(
data
)
Expression
.
createExprContext
=
Expression_createExprContext
def
StateChanceInfo_getHistory
(
self
):
wf
=
self
.
workflow
#raise NotImplementedError (wf)
#raise NotImplementedError(wf.getTypeInfo())
if
getattr
(
wf
,
'getTypeInfo'
):
tool
=
wf
.
getPortalObject
().
portal_workflow
wf_id
=
wf
.
getId
()
else
:
tool
=
aq_parent
(
aq_inner
(
wf
))
wf_id
=
wf
.
id
h
=
tool
.
getHistoryOf
(
wf_id
,
self
.
object
)
if
h
:
return
map
(
lambda
dict
:
dict
.
copy
(),
h
)
# Don't allow mutation
else
:
return
()
StateChangeInfo
.
getHistory
=
StateChanceInfo_getHistory
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