[Zope3-checkins] SVN: Zope3/trunk/src/zope/wfmc/ Fixed bugs:

Jim Fulton jim at zope.com
Thu May 12 05:50:59 EDT 2005


Log message for revision 30336:
  Fixed bugs:
  
  - InputOutput parameters did input bit not output
  
  - Errors reporting too many process args.
  

Changed:
  U   Zope3/trunk/src/zope/wfmc/process.py
  U   Zope3/trunk/src/zope/wfmc/tests.py

-=-
Modified: Zope3/trunk/src/zope/wfmc/process.py
===================================================================
--- Zope3/trunk/src/zope/wfmc/process.py	2005-05-12 01:47:51 UTC (rev 30335)
+++ Zope3/trunk/src/zope/wfmc/process.py	2005-05-12 09:50:58 UTC (rev 30336)
@@ -210,8 +210,8 @@
                 arg, args = args[0], args[1:]
                 setattr(data, parameter.__name__, arg)
         if args:
-            raise TypeError("Too many arguments. Expected %s. got %s",
-                            len(process_definition.parameter), len(arguments))
+            raise TypeError("Too many arguments. Expected %s. got %s" %
+                            (len(definition.parameters), len(arguments)))
 
         zope.event.notify(ProcessStarted(self))
         self.transition(None, (self.startTransition, ))
@@ -432,7 +432,7 @@
     def __repr__(self):
         return "ActivityStarted(%r)" % self.activity
 
-class Parameter:
+class Parameter(object):
 
     interface.implements(interfaces.IParameterDefinition)
 

Modified: Zope3/trunk/src/zope/wfmc/tests.py
===================================================================
--- Zope3/trunk/src/zope/wfmc/tests.py	2005-05-12 01:47:51 UTC (rev 30335)
+++ Zope3/trunk/src/zope/wfmc/tests.py	2005-05-12 09:50:58 UTC (rev 30336)
@@ -126,7 +126,81 @@
 
     """
 
+def test_inputoutput():
+    """
 
+    >>> from zope.wfmc import process
+    >>> pd = process.ProcessDefinition('sample')
+    >>> from zope import component, interface
+    >>> component.provideUtility(pd, name=pd.id)
+
+    >>> pd.defineParameters(
+    ...     process.InputParameter('x'),
+    ...     )
+
+    >>> pd.defineActivities(
+    ...    eek = process.ActivityDefinition(),
+    ...    ook = process.ActivityDefinition(),
+    ...    )
+
+    >>> pd.defineTransitions(process.TransitionDefinition('eek', 'ook'))
+
+    >>> pd.defineApplications(
+    ...     eek = process.Application(
+    ...         process.InputOutputParameter('x'),
+    ...         )
+    ...     )
+
+    >>> pd.activities['eek'].addApplication('eek', ['x'])
+
+    >>> class Participant(object):
+    ...     def __init__(self, activity):
+    ...         self.activity = activity
+
+    >>> from zope.wfmc.attributeintegration import AttributeIntegration
+    >>> integration = AttributeIntegration()
+    >>> pd.integration = integration
+
+    >>> integration.Participant = Participant
+
+    >>> class Eek:
+    ...     def __init__(self, participant):
+    ...         self.participant = participant
+    ...
+    ...     def start(self, x):
+    ...         self.participant.activity.workItemFinished(self, x+1)
+
+
+    >>> integration.eekWorkItem = Eek
+
+    >>> proc = pd()
+    >>> proc.start(1)
+    >>> proc.workflowRelevantData.x
+    2
+    
+    """
+def test_wrong_number_process_args_error_message():
+    """
+
+    >>> from zope.wfmc import process
+    >>> pd = process.ProcessDefinition('sample')
+    >>> from zope import component, interface
+    >>> component.provideUtility(pd, name=pd.id)
+    >>> pd.defineActivities(
+    ...    eek = process.ActivityDefinition(),
+    ...    ook = process.ActivityDefinition(),
+    ...    )
+    >>> pd.defineTransitions(process.TransitionDefinition('eek', 'ook'))
+
+    >>> proc = pd()
+    >>> proc.start(1)
+    Traceback (most recent call last):
+    ...
+    TypeError: Too many arguments. Expected 0. got 1
+    
+    """
+    
+
 def test_suite():
     from zope.testing import doctest
     suite = unittest.TestSuite()



More information about the Zope3-Checkins mailing list