add 'request' attribute to stateful adapter and transition event

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3022 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2008-12-01 16:15:09 +00:00
parent 01b8fa2c15
commit 4fe222a015
2 changed files with 8 additions and 2 deletions

View file

@ -93,6 +93,8 @@ class StatefulAdapter(Stateful):
statesAttributeName = '__stateful_states__'
request = None
def __init__(self, context):
self.context = context
@ -110,7 +112,7 @@ class StatefulAdapter(Stateful):
def notify(self, transition, previousState):
transObject = self.getStatesDefinition().transitions[transition]
notify(TransitionEvent(self.context, transObject, previousState))
notify(TransitionEvent(self.context, transObject, previousState, self.request))
class IndexInfo(object):
@ -135,9 +137,10 @@ class TransitionEvent(ObjectEvent):
implements(ITransitionEvent)
def __init__(self, obj, transition, previousState):
def __init__(self, obj, transition, previousState, request=None):
super(TransitionEvent, self).__init__(obj)
self.transition = transition
self.previousState = previousState
self.request = request

View file

@ -83,6 +83,8 @@ class IStateful(Interface):
for the current state.
"""
request = Attribute('Optional publication request.')
class IHistorizable(Interface):
""" An object that may record history information, e.g. when
@ -136,3 +138,4 @@ class ITransitionEvent(IObjectEvent):
transition = Attribute('The transition.')
previousState = Attribute('The name of the state before the transition.')
request = Attribute('Optional publication request.')