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:
parent
01b8fa2c15
commit
4fe222a015
2 changed files with 8 additions and 2 deletions
|
@ -93,6 +93,8 @@ class StatefulAdapter(Stateful):
|
||||||
|
|
||||||
statesAttributeName = '__stateful_states__'
|
statesAttributeName = '__stateful_states__'
|
||||||
|
|
||||||
|
request = None
|
||||||
|
|
||||||
def __init__(self, context):
|
def __init__(self, context):
|
||||||
self.context = context
|
self.context = context
|
||||||
|
|
||||||
|
@ -110,7 +112,7 @@ class StatefulAdapter(Stateful):
|
||||||
|
|
||||||
def notify(self, transition, previousState):
|
def notify(self, transition, previousState):
|
||||||
transObject = self.getStatesDefinition().transitions[transition]
|
transObject = self.getStatesDefinition().transitions[transition]
|
||||||
notify(TransitionEvent(self.context, transObject, previousState))
|
notify(TransitionEvent(self.context, transObject, previousState, self.request))
|
||||||
|
|
||||||
|
|
||||||
class IndexInfo(object):
|
class IndexInfo(object):
|
||||||
|
@ -135,9 +137,10 @@ class TransitionEvent(ObjectEvent):
|
||||||
|
|
||||||
implements(ITransitionEvent)
|
implements(ITransitionEvent)
|
||||||
|
|
||||||
def __init__(self, obj, transition, previousState):
|
def __init__(self, obj, transition, previousState, request=None):
|
||||||
super(TransitionEvent, self).__init__(obj)
|
super(TransitionEvent, self).__init__(obj)
|
||||||
self.transition = transition
|
self.transition = transition
|
||||||
self.previousState = previousState
|
self.previousState = previousState
|
||||||
|
self.request = request
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -83,6 +83,8 @@ class IStateful(Interface):
|
||||||
for the current state.
|
for the current state.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
request = Attribute('Optional publication request.')
|
||||||
|
|
||||||
|
|
||||||
class IHistorizable(Interface):
|
class IHistorizable(Interface):
|
||||||
""" An object that may record history information, e.g. when
|
""" An object that may record history information, e.g. when
|
||||||
|
@ -136,3 +138,4 @@ class ITransitionEvent(IObjectEvent):
|
||||||
|
|
||||||
transition = Attribute('The transition.')
|
transition = Attribute('The transition.')
|
||||||
previousState = Attribute('The name of the state before the transition.')
|
previousState = Attribute('The name of the state before the transition.')
|
||||||
|
request = Attribute('Optional publication request.')
|
||||||
|
|
Loading…
Add table
Reference in a new issue