[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/Workflow - IWorkflowProcessDefinitionConfiguration.py:1.1.2.3 IWorkflowService.py:1.2.24.5 WorkflowProcessDefinitionConfiguration.py:1.1.2.4 WorkflowService.py:1.2.24.9 configure.zcml:1.1.2.2
Florent Guillaume
fg@nuxeo.com
Thu, 5 Dec 2002 08:29:12 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Workflow
In directory cvs.zope.org:/tmp/cvs-serv27865
Modified Files:
Tag: sprintathon-wf-branch
IWorkflowProcessDefinitionConfiguration.py IWorkflowService.py
WorkflowProcessDefinitionConfiguration.py WorkflowService.py
configure.zcml
Log Message:
Added views for the PD and PD configuration object.
The tests pass.
It's now possible to manipulate these things from the ZMI.
=== Zope3/lib/python/Zope/App/Workflow/IWorkflowProcessDefinitionConfiguration.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/lib/python/Zope/App/Workflow/IWorkflowProcessDefinitionConfiguration.py:1.1.2.2 Wed Dec 4 06:04:49 2002
+++ Zope3/lib/python/Zope/App/Workflow/IWorkflowProcessDefinitionConfiguration.py Thu Dec 5 08:28:41 2002
@@ -16,6 +16,7 @@
"""
from Interface.Attribute import Attribute
+from Zope.Schema import TextLine, Text
from Zope.App.OFS.Services.ConfigurationInterfaces import IConfiguration
@@ -23,9 +24,11 @@
"""Configuration for a workflow process definition.
"""
- definitionName = Attribute("The definition name")
+ name = TextLine(title = u"Name",
+ description = u"Name for the process definition",
+ required = True)
- componentPath = Attribute("The physical path to the component")
+ path = Attribute("The physical path to the component")
def getProcessDefinition():
"""Return the definition."""
=== Zope3/lib/python/Zope/App/Workflow/IWorkflowService.py 1.2.24.4 => 1.2.24.5 ===
--- Zope3/lib/python/Zope/App/Workflow/IWorkflowService.py:1.2.24.4 Wed Dec 4 11:53:18 2002
+++ Zope3/lib/python/Zope/App/Workflow/IWorkflowService.py Thu Dec 5 08:28:41 2002
@@ -42,7 +42,3 @@
def queryConfigurations(definition_name):
"""Return an IConfigurationRegistry for a process definition name."""
-
- def createConfigurationsFor(configuration):
- """Create and return an IConfigurationRegistry."""
-
=== Zope3/lib/python/Zope/App/Workflow/WorkflowProcessDefinitionConfiguration.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/lib/python/Zope/App/Workflow/WorkflowProcessDefinitionConfiguration.py:1.1.2.3 Wed Dec 4 11:46:05 2002
+++ Zope3/lib/python/Zope/App/Workflow/WorkflowProcessDefinitionConfiguration.py Thu Dec 5 08:28:41 2002
@@ -16,9 +16,10 @@
"""
from Persistence import Persistent
-from Zope.ComponentArchitecture import getServiceManager
+from Zope.ComponentArchitecture import getServiceManager, getAdapter
from Zope.ContextWrapper import ContextMethod
from Zope.Security.Checker import CheckerPublic
+from Zope.Proxy.ContextWrapper import getWrapperContainer
from Zope.App.Traversing import traverse
from Zope.App.Traversing import getPhysicalPathString
from Zope.App.DependencyFramework.IDependable import IDependable
@@ -31,7 +32,7 @@
from Zope.App.OFS.Services.ConfigurationInterfaces import Unregistered
from Zope.App.Workflow.IWorkflowProcessDefinitionConfiguration \
- import IWorkflowProcessDefinitionConfiguration
+ import IWorkflowProcessDefinitionConfiguration
class WorkflowProcessDefinitionConfiguration(Persistent):
"""
@@ -40,16 +41,15 @@
__implements__ = (IWorkflowProcessDefinitionConfiguration,
IAddNotifiable, IDeleteNotifiable)
- def __init__(self, name, component_path, permission=None):
- self.definitionName = name
- self.componentPath = component_path
+ def __init__(self, name, path, permission=None):
+ self.name = name
+ self.path = path
if permission is None:
permission = CheckerPublic
self.permission = permission
def __repr__(self):
- return "workflow process definition(%s, %s)" % (self.definitionName,
- self.componentPath)
+ return "workflow process definition(%s, %s)" % (self.name, self.path)
############################################################
# Implementation methods for interface
@@ -59,25 +59,23 @@
definition = getattr(self, '_v_definition', None)
if definition is not None:
return definition
- sm = getServiceManager(self)
- definition = traverse(sm, self.componentPath)
+ definition = traverse(self, self.path) # path is absolute
self._v_definition = definition
return definition
getProcessDefinition = ContextMethod(getProcessDefinition)
############################################################
- # IConfigurationSummary
-
- title = u''
+ # IWorkflowProcessDefinitionConfiguration
- status = ConfigurationStatusProperty('Workflows')
+ name = ''
- ############################################################
- # IConfiguration
+ title = u''
description = u''
+ status = ConfigurationStatusProperty('Workflows')
+
def activated(self):
pass
#activated = ContextMethod(activated)
@@ -103,9 +101,10 @@
def manage_beforeDelete(self, configuration, container):
"See Zope.App.OFS.Container.IDeleteNotifiable"
sm = getServiceManager(self)
- objectstatus = self.status
+ definition = configuration.getProcessDefinition()
dependents = getAdapter(definition, IDependable)
objectpath = getPhysicalPathString(self)
+ objectstatus = self.status
if objectstatus == Active:
raise DependencyError("Can't delete active configurations")
elif objectstatus == Registered:
=== Zope3/lib/python/Zope/App/Workflow/WorkflowService.py 1.2.24.8 => 1.2.24.9 ===
--- Zope3/lib/python/Zope/App/Workflow/WorkflowService.py:1.2.24.8 Thu Dec 5 05:43:24 2002
+++ Zope3/lib/python/Zope/App/Workflow/WorkflowService.py Thu Dec 5 08:28:41 2002
@@ -19,7 +19,7 @@
"""
-from Persistence.Module import PersistentModuleRegistry
+from Persistence import Persistent
from Zope.ContextWrapper import ContextMethod
from Zope.Proxy.ContextWrapper import ContextWrapper
@@ -30,10 +30,9 @@
from Zope.App.Workflow.IWorkflowService import IWorkflowService
-class WorkflowService(PersistentModuleRegistry):
+class WorkflowService(Persistent):
- __implements__ = (IWorkflowService,
- PersistentModuleRegistry.__implements__)
+ __implements__ = IWorkflowService
def __init__(self):
super(WorkflowService, self).__init__()
@@ -71,7 +70,7 @@
queryConfigurations = ContextMethod(queryConfigurations)
def createConfigurationsFor(self, configuration):
- return self.createConfigurations(configuration.definitionName)
+ return self.createConfigurations(configuration.name)
createConfigurationsFor = ContextMethod(createConfigurationsFor)
@@ -90,7 +89,7 @@
getBoundProcessDefinition = ContextMethod(getBoundProcessDefinition)
def queryConfigurationsFor(self, configuration, default=None):
- return self.queryConfigurations(configuration.definitionName, default)
+ return self.queryConfigurations(configuration.name, default)
queryConfigurationsFor = ContextMethod(queryConfigurationsFor)
=== Zope3/lib/python/Zope/App/Workflow/configure.zcml 1.1.2.1 => 1.1.2.2 ===
--- Zope3/lib/python/Zope/App/Workflow/configure.zcml:1.1.2.1 Tue Dec 3 10:32:13 2002
+++ Zope3/lib/python/Zope/App/Workflow/configure.zcml Thu Dec 5 08:28:41 2002
@@ -3,6 +3,8 @@
xmlns:browser='http://namespaces.zope.org/browser'
xmlns:service='http://namespaces.zope.org/service'>
+<!-- Workflow Service -->
+
<content class=".WorkflowService.">
<factory
id="WorkflowService"
@@ -22,9 +24,51 @@
for="Zope.App.OFS.Container.IAdding."
action="WorkflowService"
title='Workflow Service'
- description="A Workflow Service" />
+ description="A workflow service" />
+
+
+<!-- Workflow Process Definition -->
+
+<content class=".WorkflowProcessDefinition.">
+ <factory
+ id="WorkflowProcessDefinition"
+ permission="Zope.ManageServices"
+ />
+ <require
+ permission="Zope.ManageServices"
+ attributes="createProcessInstance" />
+ <implements interface="Zope.App.OFS.Annotation.IAttributeAnnotatable." />
+</content>
+
+<browser:menuItem
+ menu="add_component"
+ for="Zope.App.OFS.Container.IAdding."
+ action="WorkflowProcessDefinition"
+ title='Workflow Process Definition'
+ description="A workflow process definition" />
+
+
+<!-- Workflow Process Definition Configuration -->
+
+<content class=".WorkflowProcessDefinitionConfiguration.">
+ <require
+ permission="Zope.ManageServices"
+ interface=".IWorkflowProcessDefinitionConfiguration."
+ set_schema=
+ ".IWorkflowProcessDefinitionConfiguration."
+ />
+ <require
+ permission="Zope.ManageServices"
+ interface="Zope.App.OFS.Container.IAddNotifiable."
+ />
+ <require
+ permission="Zope.ManageServices"
+ interface="Zope.App.OFS.Container.IDeleteNotifiable."
+ />
+</content>
+
-<!-- <include package=".Views" /> -->
+<include package=".Browser" />
</zopeConfigure>