[Zope3-checkins] CVS: Zope3/src/zope/app/interfaces/workflow - stateful.py:1.18

Stephan Richter srichter@cosmos.phy.tufts.edu
Thu, 31 Jul 2003 11:02:05 -0400


Update of /cvs-repository/Zope3/src/zope/app/interfaces/workflow
In directory cvs.zope.org:/tmp/cvs-serv10755/src/zope/app/interfaces/workflow

Modified Files:
	stateful.py 
Log Message:
Implemented relevant data for Processes (read workflows). You can specify
a schema which contains the fields that should be available as relevant 
data. Once the schema is set, you are able to specify "get" and "set" 
permissions for each field. That;s it for the setup.

When you then create a Content Object that uses the process definition for
which you declared the schema, you will see that there is a form in the 
'Workflows' tab of this content object that allows you to manipulate the
releavant data.

I also enhanced the XML Import/Export to support relevant data and their 
permissions. 

The easiest way to check all this functionality out is to uncomment the 
include directives in browser/workflow/stateful/configure.zcml and 
workflow/stateful/configure.zcml (both at the end of the file).

This completes my code and status review of the workflow package, which I
think is now ready for the beta.


=== Zope3/src/zope/app/interfaces/workflow/stateful.py 1.17 => 1.18 ===
--- Zope3/src/zope/app/interfaces/workflow/stateful.py:1.17	Wed Jul 30 11:24:06 2003
+++ Zope3/src/zope/app/interfaces/workflow/stateful.py	Thu Jul 31 11:01:31 2003
@@ -21,6 +21,7 @@
 from zope.app.security.permission import PermissionField
 
 from zope.interface import Interface, Attribute
+from zope.app.component.interfacefield import InterfaceField
 from zope.app.interfaces.workflow import IWorkflowEvent
 from zope.app.interfaces.workflow import IProcessDefinition
 from zope.app.interfaces.workflow import IProcessInstance
@@ -28,6 +29,8 @@
 
 AUTOMATIC = u'Automatic'
 MANUAL = u'Manual'
+INITIAL = u'INITIAL'
+
 
 class ITransitionEvent(IWorkflowEvent):
     """An event that signalizes a transition from one state to another."""
@@ -84,7 +87,7 @@
 
 class IState(Interface):
     """Interface for state of a stateful workflow process definition."""
-
+    # XXX Should at least have a title, if not a value as well 
 
 class IStatefulStatesContainer(IProcessDefinitionElementContainer):
     """Container that stores States."""
@@ -139,7 +142,7 @@
     # ComponentLookupError: Permissions
     # required=False does not help as well
     # so for now the permission needs to be set ttw
-    # till we found another solution
+    # till we find another solution
     permission = PermissionField(
         title=u"The permission needed to fire the Transition.",
         required=True)
@@ -198,19 +201,16 @@
 class IStatefulProcessDefinition(IProcessDefinition):
     """Interface for stateful workflow process definition."""
 
-    # XXX How to specify permissions for RelevantData ??
-
-    relevantDataSchema = zope.schema.TextLine(
-        title=u"RelevantData Schema",
-        description=u"Dotted Name of RelevantData Schema.",
-        required=True)
-
-
-    def setRelevantDataSchema(schema):
-        """Set the Schema for RelevantData."""
+    relevantDataSchema = InterfaceField(
+        title=u"Workflow-Relevant Data Schema",
+        description=u"Specifies the schema that characterizes the workflow "
+                    u"relevant data of a process instance, found in pd.data.",
+        default=None,
+        required=False)
 
-    def getRelevantDataSchema():
-        """Return the Schema for RelevantData."""
+    schemaPermissions = Attribute(u"A dictioary that maps set/get permissions"
+                                  u"on the schema's fields. Entries looks as"
+                                  u"follows: {fieldname : (set_perm, get_perm)}")
 
     states = Attribute("State objects container.")