[Zope3-checkins] SVN: Zope3/trunk/src/zope/wfmc/ Preparations for
persistent WFMC,
Adam Groszer
adamg at fw.hu
Fri Apr 28 15:16:24 EDT 2006
Log message for revision 67734:
Preparations for persistent WFMC,
as discussed at the SwissSprint
Changed:
U Zope3/trunk/src/zope/wfmc/process.py
U Zope3/trunk/src/zope/wfmc/xpdl.py
-=-
Modified: Zope3/trunk/src/zope/wfmc/process.py
===================================================================
--- Zope3/trunk/src/zope/wfmc/process.py 2006-04-28 19:06:57 UTC (rev 67733)
+++ Zope3/trunk/src/zope/wfmc/process.py 2006-04-28 19:16:23 UTC (rev 67734)
@@ -26,9 +26,28 @@
from zope.wfmc import interfaces
+def always_true(data):
+ return True
+
+class TransitionDefinition(object):
+
+ interface.implements(interfaces.ITransitionDefinition)
+
+ def __init__(self, from_, to, condition=always_true, id=None):
+ self.id = id
+ self.from_ = from_
+ self.to = to
+ self.condition = condition
+
+ def __repr__(self):
+ return "TransitionDefinition(from=%r, to=%r)" %(self.from_, self.to)
+
+
class ProcessDefinition(object):
interface.implements(interfaces.IProcessDefinition)
+
+ TransitionDefinitionFactory = TransitionDefinition
def __init__(self, id, integration=None):
self.id = id
@@ -99,7 +118,7 @@
raise interfaces.InvalidProcessDefinition(
"No start activities")
- return TransitionDefinition(None, start[0][0])
+ return self.TransitionDefinitionFactory(None, start[0][0])
_start = zope.cachedescriptors.property.Lazy(_start)
@@ -167,23 +186,6 @@
return "<ActivityDefinition %r>" %self.__name__
-def always_true(data):
- return True
-
-class TransitionDefinition(object):
-
- interface.implements(interfaces.ITransitionDefinition)
-
- def __init__(self, from_, to, condition=always_true, id=None):
- self.id = id
- self.from_ = from_
- self.to = to
- self.condition = condition
-
- def __repr__(self):
- return "TransitionDefinition(from=%r, to=%r)" %(self.from_, self.to)
-
-
class Process(persistent.Persistent):
interface.implements(interfaces.IProcess)
Modified: Zope3/trunk/src/zope/wfmc/xpdl.py
===================================================================
--- Zope3/trunk/src/zope/wfmc/xpdl.py 2006-04-28 19:06:57 UTC (rev 67733)
+++ Zope3/trunk/src/zope/wfmc/xpdl.py 2006-04-28 19:16:23 UTC (rev 67734)
@@ -65,6 +65,12 @@
start_handlers = {}
end_handlers = {}
text = u''
+
+ ProcessDefinitionFactory = zope.wfmc.process.ProcessDefinition
+ ParticipantFactory = zope.wfmc.process.Participant
+ ApplicationFactory = zope.wfmc.process.Application
+ ActivityDefinitionFactory = zope.wfmc.process.ActivityDefinition
+ TransitionDefinitionFactory = zope.wfmc.process.TransitionDefinition
def __init__(self, package):
self.package = package
@@ -120,7 +126,7 @@
def WorkflowProcess(self, attrs):
id = attrs[(None, 'Id')]
- process = zope.wfmc.process.ProcessDefinition(id)
+ process = self.ProcessDefinitionFactory(id)
process.__name__ = attrs.get((None, 'Name'))
# Copy package data:
@@ -147,14 +153,14 @@
def Participant(self, attrs):
id = attrs[(None, 'Id')]
name = attrs.get((None, 'Name'))
- participant = zope.wfmc.process.Participant(name)
+ participant = self.ParticipantFactory(name)
self.stack[-1].defineParticipants(**{str(id): participant})
start_handlers[(xpdlns, 'Participant')] = Participant
def Application(self, attrs):
id = attrs[(None, 'Id')]
name = attrs.get((None, 'Name'))
- app = zope.wfmc.process.Application()
+ app = self.ApplicationFactory()
app.id = id
if name:
app.__name__ = name
@@ -180,7 +186,7 @@
def Activity(self, attrs):
id = attrs[(None, 'Id')]
name = attrs.get((None, 'Name'))
- activity = zope.wfmc.process.ActivityDefinition(name)
+ activity = self.ActivityDefinitionFactory(name)
activity.id = id
self.stack[-1].defineActivities(**{str(id): activity})
return activity
@@ -228,7 +234,7 @@
name = attrs.get((None, 'Name'))
from_ = attrs.get((None, 'From'))
to = attrs.get((None, 'To'))
- transition = zope.wfmc.process.TransitionDefinition(from_, to)
+ transition = self.TransitionDefinitionFactory(from_, to)
transition.id = id
return transition
start_handlers[(xpdlns, 'Transition')] = Transition
@@ -239,7 +245,7 @@
def condition(self, ignored):
assert isinstance(self.stack[-1],
- zope.wfmc.process.TransitionDefinition)
+ self.TransitionDefinitionFactory)
text = self.text
self.stack[-1].condition = TextCondition("(%s)" % text)
More information about the Zope3-Checkins
mailing list