Author: justi9
Date: 2007-11-29 18:03:10 -0500 (Thu, 29 Nov 2007)
New Revision: 1404
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/broker.strings
mgmt/cumin/python/cumin/brokerprofile.py
Log:
Removes BrokerSet, long succeeded by BrokerSetForm.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2007-11-29 22:57:09 UTC (rev 1403)
+++ mgmt/cumin/python/cumin/broker.py 2007-11-29 23:03:10 UTC (rev 1404)
@@ -15,13 +15,49 @@
strings = StringCatalog(__file__)
-class BrokerSet(ItemSet):
+class BrokerSetForm(ItemSet, Form):
+ def __init__(self, app, name):
+ super(BrokerSetForm, self).__init__(app, name)
+
+ self.broker = BrokerParameter(app, "param")
+ self.add_parameter(self.broker)
+ self.add_form_parameter(self.broker)
+
+ self.brokers = ListParameter(app, "id", self.broker)
+ self.add_parameter(self.brokers)
+ self.add_form_parameter(self.brokers)
+
+ self.submit = self.Submit(app, "submit", self)
+ self.add_child(self.submit)
+
+ self.paginator = self.BrokerPaginator(app, "page")
+ self.add_child(self.paginator)
+
def get_title(self, session, model):
return "Brokers %s" % fmt_count(len(model.get_brokers()))
def get_items(self, session, model):
- return sorted_by(model.brokers(), "id")
+ start, end = self.paginator.get_bounds(session)
+ return list(Broker.select())[start:end]
+ def do_process(self, session, model):
+ if self.submit.get(session):
+ self.submit.set(session, False)
+
+ for broker in self.brokers.get(session):
+ print "broker", broker
+
+ self.page().set_redirect_url(session, session.marshal())
+
+ def render_item_checkbox_name(self, session, broker):
+ return self.brokers.path()
+
+ def render_item_checkbox_value(self, session, broker):
+ return self.broker.marshal(broker)
+
+ def render_item_checkbox_checked_attr(self, session, broker):
+ return broker in self.brokers.get(session) and
"checked=\"checked\""
+
def render_item_link(self, session, broker):
branch = session.branch()
self.page().show_broker(branch, broker).show_view(branch)
@@ -63,46 +99,6 @@
def render_item_load(self, session, broker):
return "%.2f" % random()
-class BrokerSetForm(BrokerSet, Form):
- def __init__(self, app, name):
- super(BrokerSetForm, self).__init__(app, name)
-
- self.broker = BrokerParameter(app, "param")
- self.add_parameter(self.broker)
- self.add_form_parameter(self.broker)
-
- self.brokers = ListParameter(app, "id", self.broker)
- self.add_parameter(self.brokers)
- self.add_form_parameter(self.brokers)
-
- self.submit = self.Submit(app, "submit", self)
- self.add_child(self.submit)
-
- self.paginator = self.BrokerPaginator(app, "page")
- self.add_child(self.paginator)
-
- def get_items(self, session, model):
- start, end = self.paginator.get_bounds(session)
- return list(Broker.select())[start:end]
-
- def do_process(self, session, model):
- if self.submit.get(session):
- self.submit.set(session, False)
-
- for broker in self.brokers.get(session):
- print "broker", broker
-
- self.page().set_redirect_url(session, session.marshal())
-
- def render_item_checkbox_name(self, session, broker):
- return self.brokers.path()
-
- def render_item_checkbox_value(self, session, broker):
- return self.broker.marshal(broker)
-
- def render_item_checkbox_checked_attr(self, session, broker):
- return broker in self.brokers.get(session) and
"checked=\"checked\""
-
class Submit(FormButton):
def render_content(self, session, model):
return "Submit"
Modified: mgmt/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/cumin/python/cumin/broker.strings 2007-11-29 22:57:09 UTC (rev 1403)
+++ mgmt/cumin/python/cumin/broker.strings 2007-11-29 23:03:10 UTC (rev 1404)
@@ -1,23 +1,3 @@
-[BrokerSet.html]
-<table class="mobjects">
- <tr>
- <th>Name</th>
- <th>Profile</th>
- <th>Cluster</th>
- <th>Status</th>
- </tr>
-
- {items}
-</table>
-
-[BrokerSet.item_html]
-<tr>
- <td>{item_link}</td>
- <td>{item_profile_link}</td>
- <td>{item_cluster_link}</td>
- <td>{item_status}</td>
-</tr>
-
[BrokerSetForm.html]
<form id="{id}" method="post" action="?">
<!-- <select
onchange="document.getElementById('{id}.submit').submit()"> -->
Modified: mgmt/cumin/python/cumin/brokerprofile.py
===================================================================
--- mgmt/cumin/python/cumin/brokerprofile.py 2007-11-29 22:57:09 UTC (rev 1403)
+++ mgmt/cumin/python/cumin/brokerprofile.py 2007-11-29 23:03:10 UTC (rev 1404)
@@ -74,7 +74,7 @@
def get_title(self, session, profile):
return "Configuration"
- class ProfileBrokerTab(BrokerSet):
+ class ProfileBrokerTab(BrokerSetForm):
def __init__(self, app, name):
super(BrokerProfileView.ProfileBrokerTab, self).__init__(app, name)