[Zope3-checkins] SVN: Zope3/trunk/src/zope/wfmc/ Fixed a pickling bug.

Jim Fulton jim at zope.com
Thu Feb 24 17:10:00 EST 2005


Log message for revision 29289:
  Fixed a pickling bug.
  

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-02-24 22:09:57 UTC (rev 29288)
+++ Zope3/trunk/src/zope/wfmc/process.py	2005-02-24 22:09:59 UTC (rev 29289)
@@ -146,12 +146,15 @@
 
     def definePerformer(self, performer):
         self.performer = performer
-        
+
+def always_true(data):
+    return True
+
 class TransitionDefinition:
 
     interface.implements(interfaces.ITransitionDefinition)
 
-    def __init__(self, from_, to, condition=lambda data: True):
+    def __init__(self, from_, to, condition=always_true):
         self.from_ = from_
         self.to = to
         self.condition = condition

Modified: Zope3/trunk/src/zope/wfmc/tests.py
===================================================================
--- Zope3/trunk/src/zope/wfmc/tests.py	2005-02-24 22:09:57 UTC (rev 29288)
+++ Zope3/trunk/src/zope/wfmc/tests.py	2005-02-24 22:09:59 UTC (rev 29289)
@@ -89,7 +89,38 @@
 
     """
 
+def test_pickling():
+    """
+    >>> 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'))
+
+    >>> pd.defineApplications(
+    ...     eek = process.Application(
+    ...         process.InputParameter('x'),
+    ...         process.InputParameter('y'),
+    ...         )
+    ...     )
+
+    >>> pd.activities['eek'].addApplication('eek', ['x', 'y'])
+
+
+    >>> proc = pd()
+
+    >>> import pickle
+    >>> s = pickle.dumps(proc)
+
+    """
+
+
 def test_suite():
     from zope.testing import doctest
     suite = unittest.TestSuite()



More information about the Zope3-Checkins mailing list