[Zope3-checkins]
SVN: Zope3/branches/Zope-3.1/src/zope/app/workflow/
Apply patch provided by issue 457. It really seems to fix the
Stephan Richter
srichter at cosmos.phy.tufts.edu
Wed Nov 16 16:05:51 EST 2005
Log message for revision 40177:
Apply patch provided by issue 457. It really seems to fix the
zope.app.workflow package.
Changed:
U Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/configure.zcml
U Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/definition.py
U Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/definition_index.pt
U Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/importexport_index.pt
U Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/instance_index.pt
U Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/instancecontainer_index.pt
U Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/instancecontainer_main.pt
U Zope3/branches/Zope-3.1/src/zope/app/workflow/interfaces/__init__.py
U Zope3/branches/Zope-3.1/src/zope/app/workflow/stateful/browser/ftests/test_processdefinition.py
U Zope3/branches/Zope-3.1/src/zope/app/workflow/stateful/configure.zcml
U Zope3/branches/Zope-3.1/src/zope/app/workflow/stateful/instance.py
U Zope3/branches/Zope-3.1/src/zope/app/workflow/stateful/tests/test_instance.py
U Zope3/branches/Zope-3.1/src/zope/app/workflow/stateful/tests/test_xmlimportexport.py
U Zope3/branches/Zope-3.1/src/zope/app/workflow/tests/workflowsetup.py
-=-
Modified: Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/configure.zcml
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/configure.zcml 2005-11-16 20:24:52 UTC (rev 40176)
+++ Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/configure.zcml 2005-11-16 21:05:50 UTC (rev 40177)
@@ -32,16 +32,17 @@
<!-- ProcessDefinitionElementContainer -->
-<containerViews
- for="zope.app.workflow.interfaces.IProcessDefinitionElementContainer"
- contents="zope.workflow.ManageProcessDefinitions"
- add="zope.workflow.ManageProcessDefinitions"
- />
+ <page
+ for="zope.app.workflow.interfaces.IProcessDefinitionElementContainer"
+ permission="zope.workflow.ManageProcessDefinitions"
+ class="zope.app.container.browser.contents.Contents"
+ name="contents.html"
+ attribute="contents"
+ menu="zmi_views" title="Contents" />
-<defaultView
- for="zope.app.workflow.interfaces.IProcessDefinitionElementContainer"
- name="contents.html"
- />
+ <defaultView
+ for="zope.app.workflow.interfaces.IProcessDefinitionElementContainer"
+ name="contents.html" />
<!-- ProcessInstanceContainerAdaptable
Note: Commented Out ... it is just a demo
Modified: Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/definition.py
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/definition.py 2005-11-16 20:24:52 UTC (rev 40176)
+++ Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/definition.py 2005-11-16 21:05:50 UTC (rev 40177)
@@ -15,7 +15,9 @@
$Id$
"""
+
from zope.app.traversing.api import traverse
+# registration path changed
from zope.app.component.interfaces.registration import IRegistered
from zope.app.workflow.interfaces import IProcessDefinitionImportHandler
from zope.app.workflow.interfaces import IProcessDefinitionExportHandler
Modified: Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/definition_index.pt
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/definition_index.pt 2005-11-16 20:24:52 UTC (rev 40176)
+++ Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/definition_index.pt 2005-11-16 21:05:50 UTC (rev 40177)
@@ -1,5 +1,4 @@
-<html metal:use-macro="context/@@standard_macros/page"
- i18n:domain="zope">
+<html metal:use-macro="context/@@standard_macros/page">
<head>
<title metal:fill-slot="title" i18n:translate="">Process Definition</title>
</head>
@@ -14,4 +13,4 @@
</div>
</body>
-</html>
+</html>
\ No newline at end of file
Modified: Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/importexport_index.pt
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/importexport_index.pt 2005-11-16 20:24:52 UTC (rev 40176)
+++ Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/importexport_index.pt 2005-11-16 21:05:50 UTC (rev 40177)
@@ -1,5 +1,4 @@
-<html metal:use-macro="context/@@standard_macros/view"
- i18n:domain="zope">
+<html metal:use-macro="context/@@standard_macros/view">
<body>
<div metal:fill-slot="body">
@@ -7,7 +6,7 @@
<p tal:define="success request/success | nothing"
tal:condition="success"
i18n:translate="">
- Import was successful!
+ Import was successfull!
</p>
<p i18n:translate="">Import / Export Process Definitions:</p>
@@ -28,4 +27,4 @@
</div>
</body>
</html>
-
+
\ No newline at end of file
Modified: Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/instance_index.pt
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/instance_index.pt 2005-11-16 20:24:52 UTC (rev 40176)
+++ Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/instance_index.pt 2005-11-16 21:05:50 UTC (rev 40177)
@@ -1,5 +1,4 @@
-<html metal:use-macro="context/@@standard_macros/page"
- i18n:domain="zope">
+<html metal:use-macro="context/@@standard_macros/page">
<head>
<style metal:fill-slot="headers" type="text/css">
<!--
@@ -54,4 +53,4 @@
</div>
</body>
-</html>
+</html>
\ No newline at end of file
Modified: Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/instancecontainer_index.pt
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/instancecontainer_index.pt 2005-11-16 20:24:52 UTC (rev 40176)
+++ Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/instancecontainer_index.pt 2005-11-16 21:05:50 UTC (rev 40177)
@@ -1,5 +1,4 @@
-<html metal:use-macro="context/@@standard_macros/page"
- i18n:domain="zope">
+<html metal:use-macro="context/@@standard_macros/page">
<head>
<style metal:fill-slot="headers" type="text/css">
<!--
Modified: Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/instancecontainer_main.pt
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/instancecontainer_main.pt 2005-11-16 20:24:52 UTC (rev 40176)
+++ Zope3/branches/Zope-3.1/src/zope/app/workflow/browser/instancecontainer_main.pt 2005-11-16 21:05:50 UTC (rev 40177)
@@ -1,5 +1,4 @@
-<html metal:use-macro="context/@@standard_macros/page"
- i18n:domain="zope">
+<html metal:use-macro="context/@@standard_macros/page">
<body>
<div metal:fill-slot="body">
Modified: Zope3/branches/Zope-3.1/src/zope/app/workflow/interfaces/__init__.py
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/workflow/interfaces/__init__.py 2005-11-16 20:24:52 UTC (rev 40176)
+++ Zope3/branches/Zope-3.1/src/zope/app/workflow/interfaces/__init__.py 2005-11-16 21:05:50 UTC (rev 40177)
@@ -11,7 +11,7 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""Interfaces for workflow components, definition and instance.
+"""Interfaces for workflow service, definition and instance.
$Id$
"""
Modified: Zope3/branches/Zope-3.1/src/zope/app/workflow/stateful/browser/ftests/test_processdefinition.py
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/workflow/stateful/browser/ftests/test_processdefinition.py 2005-11-16 20:24:52 UTC (rev 40176)
+++ Zope3/branches/Zope-3.1/src/zope/app/workflow/stateful/browser/ftests/test_processdefinition.py 2005-11-16 21:05:50 UTC (rev 40177)
@@ -137,7 +137,7 @@
self.assert_(body.find('initial_foo') >= 0)
- self.assert_(body.find('Import was successful!') >= 0)
+ self.assert_(body.find('Import was successfull!') >= 0)
def test_suite():
Modified: Zope3/branches/Zope-3.1/src/zope/app/workflow/stateful/configure.zcml
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/workflow/stateful/configure.zcml 2005-11-16 20:24:52 UTC (rev 40176)
+++ Zope3/branches/Zope-3.1/src/zope/app/workflow/stateful/configure.zcml 2005-11-16 21:05:50 UTC (rev 40177)
@@ -2,21 +2,27 @@
<!-- Stateful ProcessDefintion -->
-<localUtility
+<content
class=".definition.StatefulProcessDefinition">
<factory
id="zope.app.workflow.StatefulProcessDefinition"
/>
+ <implements
+ interface="zope.app.utility.interfaces.ILocalUtility"
+ />
+ <implements
+ interface="zope.app.annotation.interfaces.IAttributeAnnotatable"
+ />
<require
permission="zope.workflow.ManageProcessDefinitions"
interface=".interfaces.IStatefulProcessDefinition"
- set_schema=".interfaces.IStatefulProcessDefinition"
+ set_schema=".interfaces.IStatefulProcessDefinition"
/>
<require
permission="zope.workflow.ManageProcessDefinitions"
- interface="zope.app.container.interfaces.IReadContainer"
+ interface="zope.app.container.interfaces.IReadContainer"
/>
-</localUtility>
+</content>
<!-- States Container -->
@@ -29,8 +35,8 @@
permission="zope.workflow.ManageProcessDefinitions"
interface=".interfaces.IStatefulStatesContainer"
/>
- <implements
- interface="zope.app.annotation.interfaces.IAttributeAnnotatable"
+ <implements
+ interface="zope.app.annotation.interfaces.IAttributeAnnotatable"
/>
</content>
@@ -45,8 +51,8 @@
interface=".interfaces.IState"
set_schema=".interfaces.IState"
/>
- <implements
- interface="zope.app.annotation.interfaces.IAttributeAnnotatable"
+ <implements
+ interface="zope.app.annotation.interfaces.IAttributeAnnotatable"
/>
</content>
@@ -62,10 +68,10 @@
/>
<require
permission="zope.workflow.ManageProcessDefinitions"
- interface=".interfaces.IStatefulTransitionsContainer"
+ interface=".interfaces.IStatefulTransitionsContainer"
/>
- <implements
- interface="zope.app.annotation.interfaces.IAttributeAnnotatable"
+ <implements
+ interface="zope.app.annotation.interfaces.IAttributeAnnotatable"
/>
</content>
@@ -77,33 +83,41 @@
/>
<require
permission="zope.workflow.ManageProcessDefinitions"
- interface=".interfaces.ITransition"
+ interface=".interfaces.ITransition"
set_schema=".interfaces.ITransition"
/>
- <implements
- interface="zope.app.annotation.interfaces.IAttributeAnnotatable"
+ <implements
+ interface="zope.app.annotation.interfaces.IAttributeAnnotatable"
/>
</content>
<!-- ContentWorkflowsManager -->
-<localUtility
+<content
class=".contentworkflow.ContentWorkflowsManager">
<factory
- id="zope.app.workflow.ContentWorkflowsManager"
+ id="zope.app.workflow.ContentWorkflowsManager"
+ />
+
+ <implements
+ interface="zope.app.utility.interfaces.ILocalUtility"
/>
- <require
- permission="zope.ManageServices"
- interface=".interfaces.IContentWorkflowsManager"
- attributes="cpRegistry"
+ <implements
+ interface="zope.app.annotation.interfaces.IAttributeAnnotatable"
/>
-</localUtility>
+ <require
+ permission="zope.ManageServices"
+ interface=".interfaces.IContentWorkflowsManager"
+ attributes="cpRegistry"
+ />
+</content>
+
<class class=".instance.StatefulProcessInstance">
<require
permission="zope.workflow.UseProcessInstances"
interface=".interfaces.IStatefulProcessInstance"
- />
+ />
</class>
<!-- Stateful workflow import/Export -->
@@ -126,8 +140,12 @@
for="..interfaces.IProcessInstanceContainerAdaptable
zope.app.event.objectevent.IObjectCreatedEvent"
handler=".contentworkflow.NewObjectProcessInstanceCreator"
- />
+ >
+ Cause workflow instances to be added to content objects when they
+ are created.
+</subscriber>
+
<!-- Test Object for testing Stateful Workflows -->
<!--include file="testobject.zcml"/-->
Modified: Zope3/branches/Zope-3.1/src/zope/app/workflow/stateful/instance.py
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/workflow/stateful/instance.py 2005-11-16 20:24:52 UTC (rev 40176)
+++ Zope3/branches/Zope-3.1/src/zope/app/workflow/stateful/instance.py 2005-11-16 21:05:50 UTC (rev 40177)
@@ -18,10 +18,8 @@
from persistent import Persistent
from persistent.dict import PersistentDict
-from zope.event import notify
-
from zope.app import zapi
-from zope.app.module import resolve
+from zope.event import notify
from zope.app.workflow.interfaces import IProcessDefinition
from zope.app.workflow.stateful.interfaces import AUTOMATIC
from zope.app.workflow.stateful.interfaces import IAfterTransitionEvent
@@ -181,7 +179,6 @@
if schema:
# create relevant-data
self._data = RelevantData(schema, clean_pd.schemaPermissions)
- self._data.__parent__ = self
else:
self._data = None
# setup permission on data
@@ -276,8 +273,10 @@
if not script:
return True
if isinstance(script, (str, unicode)):
- # TODO: not tested!
- script = resolve(script)
+ #removed getServices in exchange for getSiteManager
+ #sm = zapi.getServices(self)
+ sm = zapi.getSiteManager(self)
+ script = sm.resolve(script)
return script(contexts)
def _outgoingTransitions(self, clean_pd):
Modified: Zope3/branches/Zope-3.1/src/zope/app/workflow/stateful/tests/test_instance.py
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/workflow/stateful/tests/test_instance.py 2005-11-16 20:24:52 UTC (rev 40176)
+++ Zope3/branches/Zope-3.1/src/zope/app/workflow/stateful/tests/test_instance.py 2005-11-16 21:05:50 UTC (rev 40177)
@@ -21,6 +21,7 @@
from zope.interface.verify import verifyClass
from zope.schema import Text, Int
+from zope.component.service import serviceManager
from zope.app.event.tests.placelesssetup import events, clearEvents
from zope.app.security.interfaces import IPermission
from zope.app.security.permission import Permission
@@ -31,6 +32,7 @@
from zope.app.component.interfaces.registration import IRegisterable
from zope.app.component.interfaces.registration import IRegistered
from zope.app.component.interfaces.registration import ActiveStatus
+from zope.app.servicenames import Utilities
from zope.app.workflow.tests.workflowsetup import WorkflowSetup
from zope.app.workflow.interfaces import IProcessDefinition
@@ -47,9 +49,10 @@
from zope.app.workflow.stateful.instance import StateChangeInfo
from zope.app import zapi
-from zope.app.testing import ztapi
+from zope.app.tests import ztapi
from zope.app.container.contained import contained
-from zope.app.component.site import UtilityRegistration
+from zope.app.utility import UtilityRegistration
+from zope.app.testing import setup
class ParticipationStub(object):
@@ -98,15 +101,11 @@
pd.transitions['retract_pending'] = Transition('pending', 'private')
self.default['pd1'] = pd
+
+ setup.addUtility(self.sm, 'definition1', IProcessDefinition, pd)
- name = self.cm.addRegistration(
- UtilityRegistration('definition1', IProcessDefinition,
- self.default['pd1']))
- zapi.traverse(self.default.registrationManager,
- name).status = ActiveStatus
-
- self.pd = self.sm.queryUtility(IProcessDefinition, 'definition1')
- # give the pi some context to find a utility
+ self.pd = zapi.getUtility(IProcessDefinition, name='definition1')
+ # give the pi some context to find a service
self.pi = createProcessInstance(self.sm, 'definition1')
# Let's also listen to the fired events
clearEvents()
@@ -124,9 +123,6 @@
self.assertEqual(data.text, 'no text')
self.assertEqual(data.value, 1)
- self.assertNotEqual(data.__parent__, None)
- self.assertEqual(self.pi, self.pi.data.__parent__)
-
data.text = 'another text'
self.assert_(IBeforeRelevantDataChangeEvent.providedBy(events[0]))
self.assert_(IAfterRelevantDataChangeEvent.providedBy(events[-1]))
@@ -213,14 +209,11 @@
self.default['pd1'] = pd
- n = self.cm.addRegistration(
- UtilityRegistration('definition1', IProcessDefinition,
- self.default['pd1']))
- zapi.traverse(self.default.registrationManager, n
- ).status = ActiveStatus
- self.pd = self.sm.queryUtility(IProcessDefinition, 'definition1')
- # give the pi some context to find a utility
+ setup.addUtility(self.sm, 'definition1', IProcessDefinition, pd)
+
+ self.pd = zapi.getUtility(IProcessDefinition, 'definition1')
+ # give the pi some context to find a service
self.pi = contained(
createProcessInstance(self.sm, 'definition1'),
self.rootFolder)
@@ -299,14 +292,10 @@
self.default['pd1'] = pd
- k = self.cm.addRegistration(
- UtilityRegistration('definition1', IProcessDefinition,
- self.default['pd1']))
- zapi.traverse(self.default.registrationManager,
- k).status = ActiveStatus
+ setup.addUtility(self.sm, 'definition1', IProcessDefinition, pd)
- self.pd = self.sm.queryUtility(IProcessDefinition, 'definition1')
- # give the pi some context to find a utility
+ self.pd = zapi.getUtility(IProcessDefinition, 'definition1')
+ # give the pi some context to find a service
self.pi = contained(
createProcessInstance(self.sm, 'definition1'),
self.rootFolder)
@@ -385,15 +374,11 @@
self.default['pd1'] = pd
- k = self.cm.addRegistration(
- UtilityRegistration('definition1', IProcessDefinition,
- self.default['pd1']))
- zapi.traverse(self.default.registrationManager,
- k).status = ActiveStatus
+ setup.addUtility(self.sm, 'definition1', IProcessDefinition, pd)
- self.pd = self.sm.queryUtility(IProcessDefinition, 'definition1')
+ self.pd = zapi.getUtility(IProcessDefinition, 'definition1')
# give the process instance container (pic) some context to find a
- # utility (while this is not correct, it resembles the current
+ # service (while this is not correct, it resembles the current
# behavior.
from zope.app.workflow.instance import ProcessInstanceContainerAdapter
pic = ProcessInstanceContainerAdapter(self.rootFolder)
Modified: Zope3/branches/Zope-3.1/src/zope/app/workflow/stateful/tests/test_xmlimportexport.py
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/workflow/stateful/tests/test_xmlimportexport.py 2005-11-16 20:24:52 UTC (rev 40176)
+++ Zope3/branches/Zope-3.1/src/zope/app/workflow/stateful/tests/test_xmlimportexport.py 2005-11-16 21:05:50 UTC (rev 40177)
@@ -18,28 +18,27 @@
import unittest
from StringIO import StringIO
-from zope.interface import implements, classImplements, Interface
-from zope.interface.verify import verifyClass
-from zope.schema import TextLine
-from zope.security.checker import CheckerPublic
-
from zope.app import zapi
from zope.app.annotation.attribute import AttributeAnnotations
+from zope.app.dublincore.annotatableadapter import ZDCAnnotatableAdapter
from zope.app.annotation.interfaces import IAnnotatable, IAnnotations
from zope.app.annotation.interfaces import IAttributeAnnotatable
-from zope.app.dublincore.annotatableadapter import ZDCAnnotatableAdapter
from zope.app.dublincore.interfaces import IZopeDublinCore
-from zope.app.component.interfaces.registration import IRegisterable
from zope.app.security.interfaces import IPermission
-from zope.app.security.permission import Permission
-from zope.app.component.testing import PlacefulSetup
-from zope.app.testing import ztapi
+from zope.app.component.interfaces.registration import IRegisterable
from zope.app.workflow.interfaces import IProcessDefinitionExportHandler
from zope.app.workflow.interfaces import IProcessDefinitionImportHandler
+from zope.app.security.permission import Permission
+from zope.app.site.tests.placefulsetup import PlacefulSetup
from zope.app.workflow.stateful.definition import StatefulProcessDefinition
from zope.app.workflow.stateful.definition import State, Transition
from zope.app.workflow.stateful.xmlimportexport import XMLExportHandler
from zope.app.workflow.stateful.xmlimportexport import XMLImportHandler
+from zope.app.tests import ztapi
+from zope.interface import implements, classImplements, Interface
+from zope.interface.verify import verifyClass
+from zope.schema import TextLine
+from zope.security.checker import CheckerPublic
class ISchema(Interface):
Modified: Zope3/branches/Zope-3.1/src/zope/app/workflow/tests/workflowsetup.py
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/workflow/tests/workflowsetup.py 2005-11-16 20:24:52 UTC (rev 40176)
+++ Zope3/branches/Zope-3.1/src/zope/app/workflow/tests/workflowsetup.py 2005-11-16 21:05:50 UTC (rev 40177)
@@ -15,23 +15,44 @@
$Id$
"""
+from zope.interface import implements
+from zope.component.interfaces import IUtilityService
+
from zope.app import zapi
-from zope.app.component.testing import PlacefulSetup
-from zope.app.testing import setup
+from zope.app.annotation.interfaces import IAttributeAnnotatable
+from zope.app.security.interfaces import IAuthenticationService
+from zope.app.security.principalregistry import principalRegistry
+from zope.app.servicenames import Authentication, Utilities
+from zope.app.site.tests.placefulsetup import PlacefulSetup
from zope.app.utility import LocalUtilityService
+from zope.app.tests import setup
class WorkflowSetup(PlacefulSetup):
def setUp(self):
- self.root_sm = zapi.getSiteManager()
+ #getGlobalServices has been moved
+ #self.root_sm = zapi.getGlobalServices()
+ self.root_sm = zapi.getGlobalSiteManager()
self.sm = PlacefulSetup.setUp(self, site=True)
+ setup.addService(self.sm, Utilities, LocalUtilityService())
self.default = zapi.traverse(self.sm, "default")
+ #moved to registrationManager
+ #self.cm = self.default.getRegistrationManager()
self.cm = self.default.registrationManager
self.sm1 = self.makeSite('folder1')
+ setup.addService(self.sm1, Utilities, LocalUtilityService())
self.default1 = zapi.traverse(self.sm1, "default")
+ #moved to registrationManager
+ #self.cm1 = self.default1.getRegistrationManager()
self.cm1 = self.default1.registrationManager
+
+
+ def setupAuthService(self):
+ self.root_sm.defineService(Authentication, IAuthenticationService)
+ self.root_sm.provideService(Authentication, principalRegistry)
+ return zapi.getService(Authentication, self.rootFolder)
More information about the Zope3-Checkins
mailing list