Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Products.DCWorkflow
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
Kirill Smelkov
Products.DCWorkflow
Commits
4f787f3c
Commit
4f787f3c
authored
Sep 16, 2011
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- converted three more tools
parent
b584fbbe
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
90 additions
and
124 deletions
+90
-124
Products/DCWorkflow/CHANGES.txt
Products/DCWorkflow/CHANGES.txt
+2
-0
Products/DCWorkflow/Worklists.py
Products/DCWorkflow/Worklists.py
+4
-5
Products/DCWorkflow/tests/test_DCWorkflow.py
Products/DCWorkflow/tests/test_DCWorkflow.py
+18
-23
Products/DCWorkflow/tests/test_exportimport.py
Products/DCWorkflow/tests/test_exportimport.py
+52
-88
Products/DCWorkflow/tests/test_guard.py
Products/DCWorkflow/tests/test_guard.py
+14
-8
No files found.
Products/DCWorkflow/CHANGES.txt
View file @
4f787f3c
...
...
@@ -4,6 +4,8 @@ Products.DCWorkflow Changelog
2.3.0-alpha (unreleased)
------------------------
- Made sure converted tools are used as utilities.
- Don't crash worklist's ``manage_main`` if variables are Expression objects.
(https://bugs.launchpad.net/zope-cmf/+bug/731394)
...
...
Products/DCWorkflow/Worklists.py
View file @
4f787f3c
...
...
@@ -11,8 +11,6 @@
#
##############################################################################
""" Worklists in a web-configurable workflow.
$Id$
"""
import
re
...
...
@@ -24,8 +22,9 @@ from App.class_init import InitializeClass
from
App.special_dtml
import
DTMLFile
from
OFS.SimpleItem
import
SimpleItem
from
Persistence
import
PersistentMapping
from
zope.component
import
getUtility
from
Products.CMFCore.
utils
import
getToolByName
from
Products.CMFCore.
interfaces
import
ICatalogTool
from
Products.DCWorkflow.ContainerTab
import
ContainerTab
from
Products.DCWorkflow.Expression
import
createExprContext
from
Products.DCWorkflow.Expression
import
Expression
...
...
@@ -169,7 +168,6 @@ class WorklistDefinition(SimpleItem):
if info is None:
info = {}
catalog = getToolByName(self, '
portal_catalog
')
criteria = {}
for key, values in self.var_matches.items():
...
...
@@ -183,7 +181,8 @@ class WorklistDefinition(SimpleItem):
criteria.update(kw)
return catalog.searchResults(**criteria)
ctool = getUtility(ICatalogTool)
return ctool.searchResults(**criteria)
InitializeClass(WorklistDefinition)
...
...
Products/DCWorkflow/tests/test_DCWorkflow.py
View file @
4f787f3c
...
...
@@ -17,11 +17,13 @@ import unittest
import
Testing
import
transaction
from
AccessControl.SecurityManagement
import
newSecurityManager
from
zope.component
import
adapter
from
zope.component
import
getSiteManager
from
zope.component
import
provideHandler
from
zope.interface.verify
import
verifyClass
from
AccessControl.SecurityManagement
import
newSecurityManager
from
Products.CMFCore.interfaces
import
IWorkflowTool
from
Products.CMFCore.testing
import
TraversingEventZCMLLayer
from
Products.CMFCore.tests.base.dummy
import
DummyContent
from
Products.CMFCore.tests.base.dummy
import
DummySite
...
...
@@ -32,16 +34,18 @@ from Products.CMFCore.WorkflowTool import WorkflowTool
from
Products.DCWorkflow.interfaces
import
IAfterTransitionEvent
from
Products.DCWorkflow.interfaces
import
IBeforeTransitionEvent
class
DCWorkflowDefinitionTests
(
SecurityTest
):
layer
=
TraversingEventZCMLLayer
def
setUp
(
self
):
SecurityTest
.
setUp
(
self
)
self
.
root
.
_setObject
(
'site'
,
DummySite
(
'site'
)
)
self
.
site
=
self
.
root
.
_getOb
(
'site'
)
self
.
site
.
_setObject
(
'portal_types'
,
DummyTool
()
)
self
.
site
.
_setObject
(
'portal_workflow'
,
WorkflowTool
()
)
self
.
app
.
_setObject
(
'site'
,
DummySite
(
'site'
))
self
.
site
=
self
.
app
.
_getOb
(
'site'
)
self
.
site
.
_setObject
(
'portal_types'
,
DummyTool
())
self
.
wtool
=
self
.
site
.
_setObject
(
'portal_workflow'
,
WorkflowTool
())
getSiteManager
().
registerUtility
(
self
.
wtool
,
IWorkflowTool
)
self
.
_constructDummyWorkflow
()
transaction
.
savepoint
(
optimistic
=
True
)
newSecurityManager
(
None
,
OmnipotentUser
().
__of__
(
self
.
site
))
...
...
@@ -55,10 +59,10 @@ class DCWorkflowDefinitionTests(SecurityTest):
def
_constructDummyWorkflow
(
self
):
from
Products.DCWorkflow.DCWorkflow
import
DCWorkflowDefinition
w
ftool
=
self
.
site
.
portal_workflow
w
f
tool
.
_setObject
(
'wf'
,
DCWorkflowDefinition
(
'wf'
))
w
f
tool
.
setDefaultChain
(
'wf'
)
wf
=
w
f
tool
.
wf
w
tool
=
self
.
wtool
wtool
.
_setObject
(
'wf'
,
DCWorkflowDefinition
(
'wf'
))
wtool
.
setDefaultChain
(
'wf'
)
wf
=
wtool
.
wf
wf
.
states
.
addState
(
'private'
)
sdef
=
wf
.
states
[
'private'
]
...
...
@@ -79,18 +83,15 @@ class DCWorkflowDefinitionTests(SecurityTest):
wf
.
worklists
.
addWorklist
(
'published_documents'
)
def
_getDummyWorkflow
(
self
):
wftool
=
self
.
site
.
portal_workflow
return
wftool
.
wf
return
self
.
wtool
.
wf
def
test_doActionFor
(
self
):
wftool
=
self
.
site
.
portal_workflow
wtool
=
self
.
wtool
wf
=
self
.
_getDummyWorkflow
()
dummy
=
self
.
site
.
_setObject
(
'dummy'
,
DummyContent
()
)
w
f
tool
.
notifyCreated
(
dummy
)
wtool
.
notifyCreated
(
dummy
)
self
.
assertEqual
(
wf
.
_getStatusOf
(
dummy
),
{
'state'
:
'private'
,
'comments'
:
''
}
)
wf
.
doActionFor
(
dummy
,
'publish'
,
comment
=
'foo'
)
...
...
@@ -100,7 +101,6 @@ class DCWorkflowDefinitionTests(SecurityTest):
# XXX more
def
test_events
(
self
):
events
=
[]
@
adapter
(
IBeforeTransitionEvent
)
...
...
@@ -113,7 +113,6 @@ class DCWorkflowDefinitionTests(SecurityTest):
events
.
append
(
event
)
provideHandler
(
_handleAfter
)
wftool
=
self
.
site
.
portal_workflow
wf
=
self
.
_getDummyWorkflow
()
dummy
=
self
.
site
.
_setObject
(
'dummy'
,
DummyContent
()
)
...
...
@@ -158,11 +157,10 @@ class DCWorkflowDefinitionTests(SecurityTest):
self
.
assertEquals
({
'test'
:
'bar'
,
'comment'
:
'foo'
},
evt
.
kwargs
)
def
test_checkTransitionGuard
(
self
):
wftool
=
self
.
site
.
portal_workflow
wtool
=
self
.
wtool
wf
=
self
.
_getDummyWorkflow
()
dummy
=
self
.
site
.
_setObject
(
'dummy'
,
DummyContent
()
)
w
f
tool
.
notifyCreated
(
dummy
)
wtool
.
notifyCreated
(
dummy
)
self
.
assertEqual
(
wf
.
_getStatusOf
(
dummy
),
{
'state'
:
'private'
,
'comments'
:
''
}
)
...
...
@@ -175,7 +173,6 @@ class DCWorkflowDefinitionTests(SecurityTest):
dummy
,
arg1
=
1
,
arg2
=
2
))
def
test_isActionSupported
(
self
):
wf
=
self
.
_getDummyWorkflow
()
dummy
=
self
.
site
.
_setObject
(
'dummy'
,
DummyContent
()
)
...
...
@@ -186,8 +183,6 @@ class DCWorkflowDefinitionTests(SecurityTest):
self
.
assert_
(
wf
.
isActionSupported
(
dummy
,
'publish'
,
arg1
=
1
,
arg2
=
2
))
def
test_rename
(
self
):
wftool
=
self
.
site
.
portal_workflow
wf
=
self
.
_getDummyWorkflow
()
wf
.
states
.
manage_renameObject
(
'private'
,
'private_new'
)
...
...
Products/DCWorkflow/tests/test_exportimport.py
View file @
4f787f3c
This diff is collapsed.
Click to expand it.
Products/DCWorkflow/tests/test_guard.py
View file @
4f787f3c
...
...
@@ -17,29 +17,35 @@ import unittest
import
Testing
from
AccessControl
import
getSecurityManager
from
zope.component
import
getSiteManager
from
zope.testing.cleanup
import
cleanUp
from
Products.CMFCore.interfaces
import
IWorkflowTool
from
Products.CMFCore.tests.base.dummy
import
DummyContent
from
Products.CMFCore.tests.base.dummy
import
DummySite
from
Products.CMFCore.tests.base.dummy
import
DummyTool
from
Products.CMFCore.WorkflowTool
import
WorkflowTool
from
Products.DCWorkflow.Guard
import
Guard
from
Products.DCWorkflow.DCWorkflow
import
DCWorkflowDefinition
from
Products.DCWorkflow.Guard
import
Guard
class
TestGuard
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
site
=
DummySite
(
'site'
)
self
.
site
.
_setObject
(
'portal_types'
,
DummyTool
()
)
self
.
site
.
_setObject
(
'portal_workflow'
,
WorkflowTool
()
)
self
.
site
.
_setObject
(
'portal_types'
,
DummyTool
())
# Construct a workflow
wftool
=
self
.
site
.
portal_workflow
wftool
.
_setObject
(
'wf'
,
DCWorkflowDefinition
(
'wf'
))
wftool
.
setDefaultChain
(
'wf'
)
self
.
wtool
=
WorkflowTool
()
self
.
wtool
.
_setObject
(
'wf'
,
DCWorkflowDefinition
(
'wf'
))
self
.
wtool
.
setDefaultChain
(
'wf'
)
getSiteManager
().
registerUtility
(
self
.
wtool
,
IWorkflowTool
)
def
tearDown
(
self
):
cleanUp
()
def
_getDummyWorkflow
(
self
):
return
self
.
site
.
portal_workflow
[
'wf'
]
return
self
.
wtool
.
wf
def
test_BaseGuardAPI
(
self
):
from
zope.tales.tales
import
CompilerError
...
...
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