Author: eallen
Date: 2008-08-14 09:43:12 -0400 (Thu, 14 Aug 2008)
New Revision: 2303
Modified:
mgmt/trunk/cumin/python/cumin/binding.py
mgmt/trunk/cumin/python/cumin/queue.py
mgmt/trunk/cumin/python/cumin/widgets.py
Log:
Added a pre_process method to handle setting up state switches that do a form submit
Modified: mgmt/trunk/cumin/python/cumin/binding.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/binding.py 2008-08-14 12:38:25 UTC (rev 2302)
+++ mgmt/trunk/cumin/python/cumin/binding.py 2008-08-14 13:43:12 UTC (rev 2303)
@@ -281,11 +281,6 @@
self.add_child(self.state)
def render_phase_path(self, session, vhost):
- # the hidden input phase MUST be rendered before the stateswitch
- phase = self.phase.get(session)
- if phase:
- self.state.set(session, phase)
-
return self.phase.path
def get_args(self, session):
@@ -331,6 +326,11 @@
return writer.to_string()
+ def pre_process(self, session):
+ phase = self.phase.get(session)
+ if phase:
+ self.state.set(session, phase)
+
def post_process(self, session):
self.dict_param.clear()
Modified: mgmt/trunk/cumin/python/cumin/queue.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/queue.py 2008-08-14 12:38:25 UTC (rev 2302)
+++ mgmt/trunk/cumin/python/cumin/queue.py 2008-08-14 13:43:12 UTC (rev 2303)
@@ -349,15 +349,18 @@
self.bindings = ExchangeKeysField(app, "bindings", self)
self.add_field(self.bindings)
+ def pre_process(self, session):
+ self.bindings.pre_process(session)
+
+ def post_process(self, session):
+ self.bindings.post_process(session)
+
def validate(self, session, queue_name):
super_error = super(QueueForm, self).validate(session)
(errors, form_binding_info) = self.bindings.get_binding_errors(session,
queue_name)
return (errors or super_error, form_binding_info)
class QueueAdd(QueueForm):
- def post_process(self, session):
- self.bindings.post_process(session)
-
def process_cancel(self, session):
branch = session.branch()
self.frame.show_view(branch)
@@ -528,6 +531,9 @@
return "<ul class=\"errors\" style=\"margin:0;
float:left;\"><li>%s</li></ul>" % \
"</li><li>".join(errors["no_exchanges"])
+ def pre_process(self, session):
+ self.bindings.pre_process(session)
+
def post_process(self, session):
self.bindings.post_process(session)
Modified: mgmt/trunk/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.py 2008-08-14 12:38:25 UTC (rev 2302)
+++ mgmt/trunk/cumin/python/cumin/widgets.py 2008-08-14 13:43:12 UTC (rev 2303)
@@ -146,6 +146,8 @@
def do_process(self, session, *args):
self.page.set_modal(session, True)
+ self.pre_process(session, *args)
+
if self.__cancel.get(session):
self.__cancel.set(session, False)
@@ -171,6 +173,9 @@
def post_process(self, session, *args):
pass
+ def pre_process(self, session, *args):
+ pass
+
def render_cancel_content(self, session, *args):
return "Cancel"