[Zope3-checkins] SVN: Zope3/branches/jack-e_interfacebased_workflow/src/zope/app/workflow/stateful/browser/transitionchangeform.py View that takes care of sending an event when a transition occurs. It is called by a transition change form

Julien Anguenot ja at nuxeo.com
Tue Oct 12 06:24:45 EDT 2004


Log message for revision 27988:
  View that takes care of sending an event when a transition occurs. It is called by a transition change form


Changed:
  A   Zope3/branches/jack-e_interfacebased_workflow/src/zope/app/workflow/stateful/browser/transitionchangeform.py


-=-
Added: Zope3/branches/jack-e_interfacebased_workflow/src/zope/app/workflow/stateful/browser/transitionchangeform.py
===================================================================
--- Zope3/branches/jack-e_interfacebased_workflow/src/zope/app/workflow/stateful/browser/transitionchangeform.py	2004-10-12 10:19:20 UTC (rev 27987)
+++ Zope3/branches/jack-e_interfacebased_workflow/src/zope/app/workflow/stateful/browser/transitionchangeform.py	2004-10-12 10:24:43 UTC (rev 27988)
@@ -0,0 +1,55 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+"""Transition Change Form View
+
+$Id: $
+"""
+
+from zope.app import zapi
+from zope.event import notify
+from zope.app.workflow.stateful.transition_events import \
+     TransitionUserTriggeredEvent
+
+class TransitionChangeForm:
+    """Transition Change Form view
+
+    The transition change form will have as form action the
+    sendTransistionEvent method
+    """
+
+    def __init__(self, context, request):
+        """Constructor
+        """
+        self.context=context
+        self.request=request
+
+    def sendTransitionUserTriggeredEvent(self, transition='', **kw):
+        """Send Transition Event
+
+        Construct a TransitionUserTrigerred event and then notify
+        """
+
+        event = TransitionUserTriggeredEvent(object=self.context,
+                                             transition=transition,
+                                             kwargs=kw)
+        notify(event)
+
+        #
+        # Redirect on the context default view
+        # Maybe we would like to define the redirection somewhere
+        #
+
+        redirect_url = zapi.getView(self.context, 'absolute_url', self.request)
+        self.request.response.redirect(redirect_url)



More information about the Zope3-Checkins mailing list