[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/workflow/stateful/interfaces.py Removed silly accessor and mutator methods.

Stephan Richter srichter at cosmos.phy.tufts.edu
Sun May 23 07:54:39 EDT 2004


Log message for revision 24901:

Removed silly accessor and mutator methods.

Resolved XXX comment for permissions.

Remove all custom fields; for the trigger mode we use just a simple Choice
field. sourceState and destinationState are also Choice fields using the new
"Workflow State Names" vocabulary.



-=-
Modified: Zope3/trunk/src/zope/app/workflow/stateful/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/workflow/stateful/interfaces.py	2004-05-23 11:54:34 UTC (rev 24900)
+++ Zope3/trunk/src/zope/app/workflow/stateful/interfaces.py	2004-05-23 11:54:37 UTC (rev 24901)
@@ -16,6 +16,7 @@
 $Id$
 """
 import zope.schema
+from zope.security.checker import CheckerPublic
 
 from zope.interface import Interface, Attribute
 from zope.app.workflow.interfaces import IWorkflowEvent
@@ -90,36 +91,19 @@
 
 
 
-class AvailableStatesField(zope.schema.TextLine):
-    """Available States."""
-
-    def __allowed(self):
-        pd = self.context.getProcessDefinition()
-        return pd.getStateNames()
-
-    allowed_values = property(__allowed)
-
-
-class TriggerModeField(zope.schema.TextLine):
-    """Trigger Mode."""
-
-    def __allowed(self):
-        return [MANUAL, AUTOMATIC]
-
-    allowed_values = property(__allowed)
-
-
 class ITransition(Interface):
     """Stateful workflow transition."""
 
-    sourceState = AvailableStatesField(
+    sourceState = zope.schema.Choice( 
         title=u"Source State",
         description=u"Name of the source state.",
+        vocabulary=u"Workflow State Names",
         required=True)
 
-    destinationState = AvailableStatesField(
+    destinationState = zope.schema.Choice( 
         title=u"Destination State",
         description=u"Name of the destination state.",
+        vocabulary=u"Workflow State Names",
         required=True)
 
     condition = zope.schema.TextLine(
@@ -134,59 +118,19 @@
                         transition can be fired or not.""",
         required=False)
 
-    # XXX cannot add a default value -> raises
-    # ComponentLookupError: Permissions
-    # required=False does not help as well
-    # so for now the permission needs to be set ttw
-    # till we find another solution
     permission = zope.schema.Choice(
         title=u"The permission needed to fire the Transition.",
-        vocabulary="Permissions",
+        vocabulary="Permission Ids",
+        default=CheckerPublic,
         required=True)
 
 
-    triggerMode = TriggerModeField(
+    triggerMode = zope.schema.Choice(
         title=u"Trigger Mode",
         description=u"How the Transition is triggered (Automatic/Manual)",
-        default=u"Manual")
+        default=MANUAL,
+        values=[MANUAL, AUTOMATIC])
 
-
-    def getSourceState():
-        """Get Source State."""
-
-    def setSourceState(source):
-        """Set Source State."""
-
-    def getDestinationState():
-        """Get Destination State."""
-
-    def setDestinationState(destination):
-        """Set Destination State."""
-
-    def getCondition():
-        """Get Condition."""
-
-    def setCondition(condition):
-        """Set Condition."""
-
-    def getScript():
-        """Get Script."""
-
-    def setScript(script):
-        """Set Script."""
-
-    def getPermission():
-        """Get Permission."""
-
-    def setPermission(permission):
-        """Set Permission."""
-
-    def getTriggerMode():
-        """Return the TriggerMode."""
-
-    def setTriggerMode():
-        """Set TriggerMode."""
-
     def getProcessDefinition():
         """Return the ProcessDefinition Object."""
 




More information about the Zope3-Checkins mailing list