[CMF-checkins] SVN: CMF/branches/1.6/ - backported r40340 from
trunk (this might need some more polishing,
but the tests work again)
Yvo Schubbe
y.2005- at wcm-solutions.de
Wed Nov 23 12:15:04 EST 2005
Log message for revision 40346:
- backported r40340 from trunk (this might need some more polishing, but the tests work again)
Changed:
U CMF/branches/1.6/CMFCore/DEPENDENCIES.txt
U CMF/branches/1.6/CMFCore/WorkflowTool.py
U CMF/branches/1.6/CMFCore/exportimport/configure.zcml
A CMF/branches/1.6/CMFCore/exportimport/tests/test_workflow.py
A CMF/branches/1.6/CMFCore/exportimport/workflow.py
U CMF/branches/1.6/CMFCore/tests/test_WorkflowTool.py
U CMF/branches/1.6/CMFDefault/DEPENDENCIES.txt
U CMF/branches/1.6/CMFDefault/profiles/default/export_steps.xml
U CMF/branches/1.6/CMFDefault/profiles/default/import_steps.xml
U CMF/branches/1.6/CMFDefault/profiles/default/workflows.xml
U CMF/branches/1.6/CMFDefault/tests/test_DiscussionReply.py
U CMF/branches/1.6/CMFDefault/tests/test_Image.py
U CMF/branches/1.6/CMFDefault/tests/test_Portal.py
U CMF/branches/1.6/CMFDefault/tests/test_join.py
U CMF/branches/1.6/CMFTopic/DEPENDENCIES.txt
U CMF/branches/1.6/CMFTopic/profiles/default/workflows.xml
U CMF/branches/1.6/CMFTopic/tests/test_DateC.py
U CMF/branches/1.6/DCWorkflow/DCWorkflow.py
U CMF/branches/1.6/DCWorkflow/DEPENDENCIES.txt
A CMF/branches/1.6/DCWorkflow/Extensions/
U CMF/branches/1.6/DCWorkflow/__init__.py
A CMF/branches/1.6/DCWorkflow/browser/
U CMF/branches/1.6/DCWorkflow/configure.zcml
A CMF/branches/1.6/DCWorkflow/exportimport.py
A CMF/branches/1.6/DCWorkflow/interfaces.py
A CMF/branches/1.6/DCWorkflow/profiles/
U CMF/branches/1.6/DCWorkflow/tests/test_DCWorkflow.py
A CMF/branches/1.6/DCWorkflow/tests/test_exportimport.py
U CMF/branches/1.6/DCWorkflow/tests/test_guard.py
U CMF/branches/1.6/DCWorkflow/utils.py
A CMF/branches/1.6/DCWorkflow/xml/
-=-
Modified: CMF/branches/1.6/CMFCore/DEPENDENCIES.txt
===================================================================
--- CMF/branches/1.6/CMFCore/DEPENDENCIES.txt 2005-11-23 17:11:35 UTC (rev 40345)
+++ CMF/branches/1.6/CMFCore/DEPENDENCIES.txt 2005-11-23 17:15:03 UTC (rev 40346)
@@ -1 +1,3 @@
-Zope >= 2.7.0
+Zope >= 2.8.5
+Five >= 1.2
+GenericSetup
Modified: CMF/branches/1.6/CMFCore/WorkflowTool.py
===================================================================
--- CMF/branches/1.6/CMFCore/WorkflowTool.py 2005-11-23 17:11:35 UTC (rev 40345)
+++ CMF/branches/1.6/CMFCore/WorkflowTool.py 2005-11-23 17:15:03 UTC (rev 40346)
@@ -24,8 +24,10 @@
from Globals import InitializeClass
from Globals import PersistentMapping
from OFS.Folder import Folder
+from OFS.ObjectManager import IFAwareObjectManager
from ActionProviderBase import ActionProviderBase
+from interfaces import IWorkflowDefinition
from interfaces.portal_workflow import portal_workflow as IWorkflowTool
from permissions import ManagePortal
from utils import _dtmldir
@@ -59,13 +61,16 @@
raise KeyError, name
-class WorkflowTool(UniqueObject, Folder, ActionProviderBase):
+class WorkflowTool(UniqueObject, IFAwareObjectManager, Folder,
+ ActionProviderBase):
+
""" Mediator tool, mapping workflow objects
"""
id = 'portal_workflow'
meta_type = 'CMF Workflow Tool'
__implements__ = (IWorkflowTool,
ActionProviderBase.__implements__)
+ _product_interfaces = (IWorkflowDefinition,)
_chains_by_type = None # PersistentMapping
_default_chain = ('default_workflow',)
@@ -110,12 +115,6 @@
RESPONSE.redirect(self.absolute_url() +
'/manage_main?management_view=Contents')
- def all_meta_types(self):
- return (
- {'name': 'Workflow',
- 'action': 'manage_addWorkflowForm',
- 'permission': ManagePortal },)
-
_manage_selectWorkflows = DTMLFile('selectWorkflows', _dtmldir)
security.declareProtected( ManagePortal, 'manage_selectWorkflows')
@@ -453,8 +452,7 @@
self._default_chain = tuple(ids)
security.declareProtected( ManagePortal, 'setChainForPortalTypes')
- def setChainForPortalTypes(self, pt_names, chain):
-
+ def setChainForPortalTypes(self, pt_names, chain, verify=True):
""" Set a chain for a specific portal type.
"""
cbt = self._chains_by_type
@@ -464,12 +462,12 @@
if isinstance(chain, basestring):
chain = [ wf.strip() for wf in chain.split(',') if wf.strip() ]
- ti = self._listTypeInfo()
- for t in ti:
- id = t.getId()
- if id in pt_names:
- cbt[id] = tuple(chain)
+ ti_ids = [ t.getId() for t in self._listTypeInfo() ]
+ for type_id in pt_names:
+ if verify and not (type_id in ti_ids):
+ continue
+ cbt[type_id] = tuple(chain)
security.declareProtected( ManagePortal, 'updateRoleMappings')
def updateRoleMappings(self, REQUEST=None):
@@ -491,11 +489,11 @@
security.declarePrivate('getWorkflowById')
def getWorkflowById(self, wf_id):
-
""" Retrieve a given workflow.
"""
wf = getattr(self, wf_id, None)
- if getattr(wf, '_isAWorkflow', 0):
+ if getattr(wf, '_isAWorkflow', False) or \
+ IWorkflowDefinition.providedBy(wf):
return wf
else:
return None
Modified: CMF/branches/1.6/CMFCore/exportimport/configure.zcml
===================================================================
--- CMF/branches/1.6/CMFCore/exportimport/configure.zcml 2005-11-23 17:11:35 UTC (rev 40345)
+++ CMF/branches/1.6/CMFCore/exportimport/configure.zcml 2005-11-23 17:15:03 UTC (rev 40346)
@@ -1,7 +1,5 @@
<configure
xmlns="http://namespaces.zope.org/zope"
- xmlns:five="http://namespaces.zope.org/five"
- i18n_domain="cmf"
>
<adapter
@@ -124,4 +122,11 @@
for="Products.CMFCore.interfaces.ITypeInformation"
/>
+ <adapter
+ factory=".workflow.WorkflowToolXMLAdapter"
+ provides="Products.GenericSetup.interfaces.IBody"
+ for="Products.CMFCore.interfaces.IWorkflowTool
+ Products.GenericSetup.interfaces.ISetupContext"
+ />
+
</configure>
Copied: CMF/branches/1.6/CMFCore/exportimport/tests/test_workflow.py (from rev 40340, CMF/trunk/CMFCore/exportimport/tests/test_workflow.py)
Copied: CMF/branches/1.6/CMFCore/exportimport/workflow.py (from rev 40340, CMF/trunk/CMFCore/exportimport/workflow.py)
Modified: CMF/branches/1.6/CMFCore/tests/test_WorkflowTool.py
===================================================================
--- CMF/branches/1.6/CMFCore/tests/test_WorkflowTool.py 2005-11-23 17:11:35 UTC (rev 40345)
+++ CMF/branches/1.6/CMFCore/tests/test_WorkflowTool.py 2005-11-23 17:15:03 UTC (rev 40346)
@@ -138,22 +138,13 @@
class WorkflowToolTests(TestCase, WarningInterceptor):
- def setUp( self ):
- from Products.CMFCore.WorkflowTool import addWorkflowFactory
- addWorkflowFactory( DummyWorkflow )
-
- def tearDown( self ):
- from Products.CMFCore.WorkflowTool import _removeWorkflowFactory
- _removeWorkflowFactory( DummyWorkflow )
- self._free_warning_output()
-
def _makeOne( self, workflow_ids=() ):
from Products.CMFCore.WorkflowTool import WorkflowTool
tool = WorkflowTool()
for workflow_id in workflow_ids:
- tool.manage_addWorkflow( DummyWorkflow.meta_type, workflow_id )
+ tool._setObject(workflow_id, DummyWorkflow(workflow_id))
return tool
Modified: CMF/branches/1.6/CMFDefault/DEPENDENCIES.txt
===================================================================
--- CMF/branches/1.6/CMFDefault/DEPENDENCIES.txt 2005-11-23 17:11:35 UTC (rev 40345)
+++ CMF/branches/1.6/CMFDefault/DEPENDENCIES.txt 2005-11-23 17:15:03 UTC (rev 40346)
@@ -1,3 +1,4 @@
-Zope >= 2.7.0
+Zope >= 2.8.5
+Five >= 1.2
CMFCore
CMFTopic
Modified: CMF/branches/1.6/CMFDefault/profiles/default/export_steps.xml
===================================================================
--- CMF/branches/1.6/CMFDefault/profiles/default/export_steps.xml 2005-11-23 17:11:35 UTC (rev 40345)
+++ CMF/branches/1.6/CMFDefault/profiles/default/export_steps.xml 2005-11-23 17:15:03 UTC (rev 40346)
@@ -61,7 +61,7 @@
Export types tool's type information objects.
</export-step>
<export-step id="workflows"
- handler="Products.CMFSetup.workflow.exportWorkflowTool"
+ handler="Products.CMFCore.exportimport.workflow.exportWorkflowTool"
title="Workflow Tool">
Export workflow tool's workflow definitions and supporting scripts.
</export-step>
Modified: CMF/branches/1.6/CMFDefault/profiles/default/import_steps.xml
===================================================================
--- CMF/branches/1.6/CMFDefault/profiles/default/import_steps.xml 2005-11-23 17:11:35 UTC (rev 40345)
+++ CMF/branches/1.6/CMFDefault/profiles/default/import_steps.xml 2005-11-23 17:15:03 UTC (rev 40346)
@@ -73,10 +73,9 @@
Import various settings from PortalGenerator.
</import-step>
<import-step id="workflow" version="20040630-01"
- handler="Products.CMFSetup.workflow.importWorkflowTool"
+ handler="Products.CMFCore.exportimport.workflow.importWorkflowTool"
title="Workflow Tool">
<dependency step="toolset"/>
- <dependency step="typeinfo"/>
Import workflow tool's workflow definitions and supporting scripts.
</import-step>
</import-steps>
Modified: CMF/branches/1.6/CMFDefault/profiles/default/workflows.xml
===================================================================
--- CMF/branches/1.6/CMFDefault/profiles/default/workflows.xml 2005-11-23 17:11:35 UTC (rev 40345)
+++ CMF/branches/1.6/CMFDefault/profiles/default/workflows.xml 2005-11-23 17:15:03 UTC (rev 40346)
@@ -1,17 +1,12 @@
<?xml version="1.0"?>
-<workflow-tool>
- <workflow workflow_id="default_workflow"
- meta_type="Workflow"
- filename="workflows/default_workflow/definition.xml"/>
+<object name="portal_workflow" meta_type="CMF Workflow Tool">
+ <property name="title"></property>
+ <object name="default_workflow" meta_type="Workflow"/>
<bindings>
<default>
<bound-workflow workflow_id="default_workflow"/>
</default>
- <type type_id="CMF BTree Folder">
-
- </type>
- <type type_id="Folder">
-
- </type>
+ <type type_id="CMF BTree Folder"/>
+ <type type_id="Folder"/>
</bindings>
-</workflow-tool>
+</object>
Modified: CMF/branches/1.6/CMFDefault/tests/test_DiscussionReply.py
===================================================================
--- CMF/branches/1.6/CMFDefault/tests/test_DiscussionReply.py 2005-11-23 17:11:35 UTC (rev 40345)
+++ CMF/branches/1.6/CMFDefault/tests/test_DiscussionReply.py 2005-11-23 17:15:03 UTC (rev 40346)
@@ -26,8 +26,10 @@
PlacelessSetup.setUp(self)
RequestTest.setUp(self)
zcml.load_config('meta.zcml', Products.Five)
+ zcml.load_config('permissions.zcml', Products.Five)
zcml.load_config('configure.zcml', Products.GenericSetup)
zcml.load_config('configure.zcml', Products.CMFCore)
+ zcml.load_config('configure.zcml', Products.DCWorkflow)
try:
factory = self.root.manage_addProduct['CMFDefault'].addConfiguredSite
factory('cmf', 'CMFDefault:default', snapshot=False)
Modified: CMF/branches/1.6/CMFDefault/tests/test_Image.py
===================================================================
--- CMF/branches/1.6/CMFDefault/tests/test_Image.py 2005-11-23 17:11:35 UTC (rev 40345)
+++ CMF/branches/1.6/CMFDefault/tests/test_Image.py 2005-11-23 17:15:03 UTC (rev 40346)
@@ -143,8 +143,10 @@
PlacelessSetup.setUp(self)
RequestTest.setUp(self)
zcml.load_config('meta.zcml', Products.Five)
+ zcml.load_config('permissions.zcml', Products.Five)
zcml.load_config('configure.zcml', Products.GenericSetup)
zcml.load_config('configure.zcml', Products.CMFCore)
+ zcml.load_config('configure.zcml', Products.DCWorkflow)
try:
newSecurityManager(None, UnrestrictedUser('manager', '', ['Manager'], []))
factory = self.root.manage_addProduct['CMFDefault'].addConfiguredSite
Modified: CMF/branches/1.6/CMFDefault/tests/test_Portal.py
===================================================================
--- CMF/branches/1.6/CMFDefault/tests/test_Portal.py 2005-11-23 17:11:35 UTC (rev 40345)
+++ CMF/branches/1.6/CMFDefault/tests/test_Portal.py 2005-11-23 17:15:03 UTC (rev 40346)
@@ -64,6 +64,19 @@
return content
+ def setUp(self):
+ PlacelessSetup.setUp(self)
+ SecurityRequestTest.setUp(self)
+ zcml.load_config('meta.zcml', Products.Five)
+ zcml.load_config('permissions.zcml', Products.Five)
+ zcml.load_config('configure.zcml', Products.GenericSetup)
+ zcml.load_config('configure.zcml', Products.CMFCore)
+ zcml.load_config('configure.zcml', Products.DCWorkflow)
+
+ def tearDown(self):
+ SecurityRequestTest.tearDown(self)
+ PlacelessSetup.tearDown(self)
+
def test_new( self ):
site = self._makeSite()
Modified: CMF/branches/1.6/CMFDefault/tests/test_join.py
===================================================================
--- CMF/branches/1.6/CMFDefault/tests/test_join.py 2005-11-23 17:11:35 UTC (rev 40345)
+++ CMF/branches/1.6/CMFDefault/tests/test_join.py 2005-11-23 17:15:03 UTC (rev 40346)
@@ -6,11 +6,28 @@
import Zope as Zope2
Zope2.startup()
+import Products
+from Products.Five import zcml
+
+from Products.CMFCore.tests.base.testcase import PlacelessSetup
from Products.CMFCore.tests.base.testcase import TransactionalTest
-class MembershipTests( TransactionalTest ):
+class MembershipTests(PlacelessSetup, TransactionalTest):
+ def setUp(self):
+ PlacelessSetup.setUp(self)
+ TransactionalTest.setUp(self)
+ zcml.load_config('meta.zcml', Products.Five)
+ zcml.load_config('permissions.zcml', Products.Five)
+ zcml.load_config('configure.zcml', Products.GenericSetup)
+ zcml.load_config('configure.zcml', Products.CMFCore)
+ zcml.load_config('configure.zcml', Products.DCWorkflow)
+
+ def tearDown(self):
+ TransactionalTest.tearDown(self)
+ PlacelessSetup.tearDown(self)
+
def _makePortal(self):
# Create a portal instance suitable for testing
factory = self.root.manage_addProduct['CMFDefault'].addConfiguredSite
Modified: CMF/branches/1.6/CMFTopic/DEPENDENCIES.txt
===================================================================
--- CMF/branches/1.6/CMFTopic/DEPENDENCIES.txt 2005-11-23 17:11:35 UTC (rev 40345)
+++ CMF/branches/1.6/CMFTopic/DEPENDENCIES.txt 2005-11-23 17:15:03 UTC (rev 40346)
@@ -1,3 +1,4 @@
-Zope >= 2.7.0
+Zope >= 2.8.5
+Five >= 1.2
CMFCore
CMFDefault
Modified: CMF/branches/1.6/CMFTopic/profiles/default/workflows.xml
===================================================================
--- CMF/branches/1.6/CMFTopic/profiles/default/workflows.xml 2005-11-23 17:11:35 UTC (rev 40345)
+++ CMF/branches/1.6/CMFTopic/profiles/default/workflows.xml 2005-11-23 17:15:03 UTC (rev 40346)
@@ -1,8 +1,6 @@
<?xml version="1.0"?>
-<workflow-tool>
+<object name="portal_workflow" meta_type="CMF Workflow Tool">
<bindings>
- <type type_id="Topic">
-
- </type>
+ <type type_id="Topic"/>
</bindings>
-</workflow-tool>
+</object>
Modified: CMF/branches/1.6/CMFTopic/tests/test_DateC.py
===================================================================
--- CMF/branches/1.6/CMFTopic/tests/test_DateC.py 2005-11-23 17:11:35 UTC (rev 40345)
+++ CMF/branches/1.6/CMFTopic/tests/test_DateC.py 2005-11-23 17:15:03 UTC (rev 40346)
@@ -15,17 +15,17 @@
$Id$
"""
-from unittest import TestSuite, makeSuite, main
+import unittest
import Testing
-import Zope2
-Zope2.startup()
import Products
from DateTime.DateTime import DateTime
+
from Products.CMFCore.tests.base.testcase import PlacelessSetup
from Products.CMFCore.tests.base.testcase import RequestTest
from Products.CMFCore.tests.base.dummy import DummyContent
from Products.CMFTopic.Topic import Topic
+
from common import CriterionTestCase
@@ -165,8 +165,10 @@
PlacelessSetup.setUp(self)
RequestTest.setUp(self)
zcml.load_config('meta.zcml', Products.Five)
+ zcml.load_config('permissions.zcml', Products.Five)
zcml.load_config('configure.zcml', Products.GenericSetup)
zcml.load_config('configure.zcml', Products.CMFCore)
+ zcml.load_config('configure.zcml', Products.DCWorkflow)
factory = self.root.manage_addProduct['CMFDefault'].addConfiguredSite
factory('site', 'CMFDefault:default', snapshot=False)
@@ -381,10 +383,10 @@
def test_suite():
- return TestSuite((
- makeSuite(FriendlyDateCriterionTests),
- makeSuite(FriendlyDateCriterionFunctionalTests),
+ return unittest.TestSuite((
+ unittest.makeSuite(FriendlyDateCriterionTests),
+ unittest.makeSuite(FriendlyDateCriterionFunctionalTests),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
+ unittest.main(defaultTest='test_suite')
Modified: CMF/branches/1.6/DCWorkflow/DCWorkflow.py
===================================================================
--- CMF/branches/1.6/DCWorkflow/DCWorkflow.py 2005-11-23 17:11:35 UTC (rev 40345)
+++ CMF/branches/1.6/DCWorkflow/DCWorkflow.py 2005-11-23 17:15:03 UTC (rev 40346)
@@ -26,10 +26,12 @@
from Globals import InitializeClass
from OFS.Folder import Folder
from OFS.ObjectManager import bad_id
+from zope.interface import implements
# CMFCore
+from Products.CMFCore.interfaces import IWorkflowDefinition
from Products.CMFCore.interfaces.portal_workflow \
- import WorkflowDefinition as IWorkflowDefinition
+ import WorkflowDefinition as z2IWorkflowDefinition
from Products.CMFCore.utils import getToolByName
from Products.CMFCore.WorkflowCore import ObjectDeleted
from Products.CMFCore.WorkflowCore import ObjectMoved
@@ -37,6 +39,7 @@
from Products.CMFCore.WorkflowTool import addWorkflowFactory
# DCWorkflow
+from interfaces import IDCWorkflowDefinition
from permissions import ManagePortal
from utils import _dtmldir
from utils import modifyRolesForPermission
@@ -63,9 +66,9 @@
UI methods are in WorkflowUIMixin.
'''
- __implements__ = IWorkflowDefinition
+ implements(IDCWorkflowDefinition, IWorkflowDefinition)
+ __implements__ = z2IWorkflowDefinition
- meta_type = 'Workflow'
title = 'DC Workflow Definition'
_isAWorkflow = 1
Modified: CMF/branches/1.6/DCWorkflow/DEPENDENCIES.txt
===================================================================
--- CMF/branches/1.6/DCWorkflow/DEPENDENCIES.txt 2005-11-23 17:11:35 UTC (rev 40345)
+++ CMF/branches/1.6/DCWorkflow/DEPENDENCIES.txt 2005-11-23 17:15:03 UTC (rev 40346)
@@ -1,2 +1,4 @@
-Zope >= 2.7.0
+Zope >= 2.8.5
+Five >= 1.2
CMFCore
+GenericSetup
Copied: CMF/branches/1.6/DCWorkflow/Extensions (from rev 40340, CMF/trunk/DCWorkflow/Extensions)
Modified: CMF/branches/1.6/DCWorkflow/__init__.py
===================================================================
--- CMF/branches/1.6/DCWorkflow/__init__.py 2005-11-23 17:11:35 UTC (rev 40345)
+++ CMF/branches/1.6/DCWorkflow/__init__.py 2005-11-23 17:15:03 UTC (rev 40346)
@@ -15,7 +15,11 @@
$Id$
"""
+from Products.CMFCore.interfaces import ISiteRoot
from Products.CMFCore.utils import registerIcon
+from Products.GenericSetup import EXTENSION
+from Products.GenericSetup import profile_registry
+
import DCWorkflow, States, Transitions, Variables, Worklists, Scripts
import Default
@@ -41,3 +45,11 @@
Worklists.WorklistDefinition.icon = Worklists.Worklists.icon
registerIcon(Scripts.Scripts,
'images/script.gif', globals())
+
+ profile_registry.registerProfile('revision2',
+ 'CMF Default Workflow [Revision 2]',
+ 'Adds revision 2 of default workflow.',
+ 'profiles/revision2',
+ 'DCWorkflow',
+ EXTENSION,
+ for_=ISiteRoot)
Copied: CMF/branches/1.6/DCWorkflow/browser (from rev 40340, CMF/trunk/DCWorkflow/browser)
Modified: CMF/branches/1.6/DCWorkflow/configure.zcml
===================================================================
--- CMF/branches/1.6/DCWorkflow/configure.zcml 2005-11-23 17:11:35 UTC (rev 40345)
+++ CMF/branches/1.6/DCWorkflow/configure.zcml 2005-11-23 17:15:03 UTC (rev 40346)
@@ -1,7 +1,25 @@
<configure
+ xmlns="http://namespaces.zope.org/zope"
xmlns:five="http://namespaces.zope.org/five"
>
+ <include package=".browser"/>
+
+ <five:registerClass
+ class=".DCWorkflow.DCWorkflowDefinition"
+ meta_type="Workflow"
+ addview="addDCWorkflowDefinition.html"
+ permission="cmf.ManagePortal"
+ global="False"
+ />
+
+ <adapter
+ factory=".exportimport.DCWorkflowDefinitionBodyAdapter"
+ provides="Products.GenericSetup.interfaces.IBody"
+ for=".interfaces.IDCWorkflowDefinition
+ Products.GenericSetup.interfaces.ISetupContext"
+ />
+
<five:implements
class=".DCWorkflow.DCWorkflowDefinition"
interface="Products.CMFCore.interfaces.IWorkflowDefinition"
Copied: CMF/branches/1.6/DCWorkflow/exportimport.py (from rev 40340, CMF/trunk/DCWorkflow/exportimport.py)
Copied: CMF/branches/1.6/DCWorkflow/interfaces.py (from rev 40340, CMF/trunk/DCWorkflow/interfaces.py)
Copied: CMF/branches/1.6/DCWorkflow/profiles (from rev 40340, CMF/trunk/DCWorkflow/profiles)
Modified: CMF/branches/1.6/DCWorkflow/tests/test_DCWorkflow.py
===================================================================
--- CMF/branches/1.6/DCWorkflow/tests/test_DCWorkflow.py 2005-11-23 17:11:35 UTC (rev 40345)
+++ CMF/branches/1.6/DCWorkflow/tests/test_DCWorkflow.py 2005-11-23 17:15:03 UTC (rev 40346)
@@ -26,19 +26,15 @@
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 addWorkflowFactory
from Products.CMFCore.WorkflowTool import WorkflowTool
class DCWorkflowDefinitionTests(TestCase):
def setUp(self):
- from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition
-
self.site = DummySite('site')
self.site._setObject( 'portal_types', DummyTool() )
self.site._setObject( 'portal_workflow', WorkflowTool() )
- addWorkflowFactory(DCWorkflowDefinition)
self._constructDummyWorkflow()
def test_z2interfaces(self):
@@ -61,9 +57,10 @@
verifyClass(IWorkflowDefinition, DCWorkflowDefinition)
def _constructDummyWorkflow(self):
+ from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition
wftool = self.site.portal_workflow
- wftool.manage_addWorkflow('Workflow (DC Workflow Definition)', 'wf')
+ wftool._setObject('wf', DCWorkflowDefinition('wf'))
wftool.setDefaultChain('wf')
wf = wftool.wf
Copied: CMF/branches/1.6/DCWorkflow/tests/test_exportimport.py (from rev 40340, CMF/trunk/DCWorkflow/tests/test_exportimport.py)
Modified: CMF/branches/1.6/DCWorkflow/tests/test_guard.py
===================================================================
--- CMF/branches/1.6/DCWorkflow/tests/test_guard.py 2005-11-23 17:11:35 UTC (rev 40345)
+++ CMF/branches/1.6/DCWorkflow/tests/test_guard.py 2005-11-23 17:15:03 UTC (rev 40346)
@@ -15,32 +15,31 @@
$Id$
"""
-from unittest import TestCase, TestSuite, makeSuite, main
+import unittest
+import Testing
from AccessControl import getSecurityManager
from Products.PageTemplates.TALES import CompilerError
+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.CMFCore.WorkflowTool import addWorkflowFactory
from Products.DCWorkflow.Guard import Guard
from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition
-from Products.CMFCore.tests.base.dummy import DummyContent
-from Products.CMFCore.tests.base.dummy import DummySite
-from Products.CMFCore.tests.base.dummy import DummyTool
-class TestGuard(TestCase):
+class TestGuard(unittest.TestCase):
def setUp(self):
self.site = DummySite('site')
self.site._setObject( 'portal_types', DummyTool() )
self.site._setObject( 'portal_workflow', WorkflowTool() )
- addWorkflowFactory(DCWorkflowDefinition)
# Construct a workflow
wftool = self.site.portal_workflow
- wftool.manage_addWorkflow('Workflow (DC Workflow Definition)', 'wf')
+ wftool._setObject('wf', DCWorkflowDefinition('wf'))
wftool.setDefaultChain('wf')
def _getDummyWorkflow(self):
@@ -260,11 +259,11 @@
# XXX more tests with permissions and roles
+
def test_suite():
- return TestSuite((
- makeSuite(TestGuard),
+ return unittest.TestSuite((
+ unittest.makeSuite(TestGuard),
))
if __name__ == '__main__':
- main(defaultTest='test_suite')
-
+ unittest.main(defaultTest='test_suite')
Modified: CMF/branches/1.6/DCWorkflow/utils.py
===================================================================
--- CMF/branches/1.6/DCWorkflow/utils.py 2005-11-23 17:11:35 UTC (rev 40345)
+++ CMF/branches/1.6/DCWorkflow/utils.py 2005-11-23 17:15:03 UTC (rev 40346)
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (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.
-#
+#
##############################################################################
""" Some common utilities.
@@ -16,15 +16,15 @@
"""
import os
+
+from AccessControl.Permission import Permission
+from AccessControl.Role import gather_permissions
from App.Common import package_home
_dtmldir = os.path.join( package_home( globals() ), 'dtml' )
+_xmldir = os.path.join( package_home( globals() ), 'xml' )
-from AccessControl.Role import gather_permissions
-from AccessControl.Permission import Permission
-from Acquisition import aq_base
-
def ac_inherited_permissions(ob, all=0):
# Get all permissions not defined in ourself that are inherited
# This will be a sequence of tuples with a name as the first item and
Copied: CMF/branches/1.6/DCWorkflow/xml (from rev 40340, CMF/trunk/DCWorkflow/xml)
More information about the CMF-checkins
mailing list